peter-murray / node-hue-api

Node.js Library for interacting with the Philips Hue Bridge and Lights
Apache License 2.0
1.19k stars 145 forks source link

Convert CIE 1931 to RGB #77

Closed mwittig closed 8 years ago

mwittig commented 8 years ago

I think it would be very useful if the library also provides for converting the CIE 1931 color state of a device to RGB (and the other color models). As far as I can see this is currently not supported. It should be fairly simple to implement. See also https://github.com/bjohnso5/hue-hacking/blob/master/src/colors.js#L251

peter-murray commented 8 years ago

Could you please elaborate on what it is you want to do here? What type of call/values do you want in the API, as the hue does not actually support rgb and I am already doing conversions around that in to the xy co ordinate system, just not for a group, as the conversion needs to be done per type of bulb/lamp.

If you could explain what you are specifically wanting, I don't mind adding it if it fits in to the API.

Thanks

mwittig commented 8 years ago

I have a RGB color picker which allows for setting the color a RGB bulb. It shall also be set to the bulb's current color state. This is to make sure the state of the color picker actually reflects the current state of the bulb if the color value has been changed by some other application.

peter-murray commented 8 years ago

The conversion is not as good as I would have hoped for. I will continue to look into the options around doing this to see if I can make it more accurate in a future revision.

You should be able to test this using the 2.1.1 version of the library and the lightStatusWithRGB() function.

Any feedback on this is appreciated.