From 01a331056b85ca62d103c380ce29c4a4f5d7baad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20M=C3=BCller=20=28ChaoticByte=29?= Date: Fri, 4 Aug 2023 19:52:50 +0200 Subject: [PATCH] Fixed a typo in the rgb_to_hsv converter --- DOCUMENTATION.md | 2 +- yahuelib/utils.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md index 2d4cf3d..9e68e43 100644 --- a/DOCUMENTATION.md +++ b/DOCUMENTATION.md @@ -472,7 +472,7 @@ Check if the motion sensor detected the presence of someone in it's reach def rgb_to_hsv(r: int, g: int, b: int) -> tuple ``` -Convert RGB colors `(255, 220, 100)` to Philips Hue's hue, saturation and brightness values `(8456, 149, 245)` imprecisely +Convert RGB colors `(255, 220, 100)` to Philips Hue's hue, saturation and brightness values `(8456, 154, 254)` imprecisely diff --git a/yahuelib/utils.py b/yahuelib/utils.py index a0d0f7e..ba5cb5b 100644 --- a/yahuelib/utils.py +++ b/yahuelib/utils.py @@ -5,7 +5,7 @@ from colorsys import rgb_to_hsv as _rgb_to_hsv def rgb_to_hsv(r:int, g:int, b:int) -> tuple: - '''Convert RGB colors `(255, 220, 100)` to Philips Hue's hue, saturation and brightness values `(8456, 149, 245)` imprecisely''' + '''Convert RGB colors `(255, 220, 100)` to Philips Hue's hue, saturation and brightness values `(8456, 154, 254)` imprecisely''' assert type(r) == int assert type(g) == int assert type(b) == int @@ -13,7 +13,7 @@ def rgb_to_hsv(r:int, g:int, b:int) -> tuple: g_ = g / 255.0 b_ = b / 255.0 h_, s_, v_ = _rgb_to_hsv(r_, g_, b_) - hsv = (round(h_ * 65535.0), round(s_ * 245.0), round(v_ * 245.0)) + hsv = (round(h_ * 65535.0), round(s_ * 254.0), round(v_ * 254.0)) return hsv def kelvin_to_mired(kelvin:int):