Closed Exergist closed 3 years ago
There's no best way for the color conversion. There are three ColorConverters available, they are contributed by different people. Choose the one that you like. And it's possible to create your own ColorConversion if that's what you need.
For others that may come looking, based on my testing (with Gamut C lights), I've found it useful to keep in mind the idea of Hue light TARGET vs ~ACTUAL color.
light.State.ToHex()
seems to accurately report what a hex color a light is targeting (with 'light' being a Q42.HueApi.Light
)Q42.HueApi.ColorConverts.Gamut.LightExtensions.ToHex(light)
seems to report a hex color that is closer to what the light is displayingAgain, this is based on my testing with Gamut C lights, and your experience might be different.
@michielpost if you have no further comments feel free to close this issue.
If I set my (gamut C for reference) hue light to "Violet" (RGB = 237,130,237 or #EE82EE) and then perform the following...
...then the rgb matrix is as follows:
Note that the first entry in the rgb matrix (corresponding to
light.State.ToRgb()
) yields the closest match to "Violet." Note that I specifically chose "Violet" in this case because it naturally exists in all gamuts and does not contain '255' as an RGB value (since Hue lights cannot reach '255' on a given color channel).I guess I wasn't expecting this kind of discrepancy, especially since this color should be within all the gamut triangles. HOWEVER if I had to guess, I'd say the (254,181,227) RGB value LOOKS more like what my Hue light displays. Thoughts?