From ffa2a823767362ffa0f33a8a7af8fd57d46bf6a9 Mon Sep 17 00:00:00 2001 From: neoteknic Date: Tue, 26 Jun 2018 14:22:31 +0200 Subject: [PATCH] Fix brigthness The most accurate way to set brigthness for RGB, is to alway take the max R,G,B value (If you try a colorpicker, you set 150, 43,56, and you change only the hue, you alway have 150 on R, G or B, and brigthness will not change. exemaple : With RGB (0 ,0, 255) you expect a 100% brigth blue so bri = 255 If you take Y you have a wrong very low blue (4,7% brightness). --- library/Phue/Helper/ColorConversion.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Phue/Helper/ColorConversion.php b/library/Phue/Helper/ColorConversion.php index 4e0dde0..2f66ab8 100644 --- a/library/Phue/Helper/ColorConversion.php +++ b/library/Phue/Helper/ColorConversion.php @@ -56,7 +56,7 @@ public static function convertRGBToXY($red, $green, $blue) return array( 'x' => $x, 'y' => $y, - 'bri' => round($xyz['y'] * 255) + 'bri' => max($red,$green,$blue) ); }