Mapping of hue's and saturation numbers to actual colors?

I’m writing a smart app that responds to certain weather events to change the color of my light accordingly.

For example, if it’s raining, I want my light to be “blue”.
In the documentation, I only see that this is possible through setHue() and setSaturation()

My question is: since Hue and Saturation are values 0-100, how can I find out what “blue” is, or what “red” is?
In other words, what hue and saturation combinations result in what colors?

I do NOT have a phillips HUE bulb, it’s another bulb with colorControl capability.


Generally speaking you want to think of a color wheel and you start at the center. Saturation is how far out toward the rim you go (controls how “colorful” the item is, aka deep blue is high saturation, white is 0 saturation) and Hue is the direction from 0-360 degrees. Red is typically 0 degrees or 0 hue, and blue tends to be around 250 degrees or 70 hue (250/360)*100 = 70. You can search for hue/saturation color charts to see how colors progress along the hue continuum.

Unfortunately for smart devices this can vary from light to light because of the specific color spectrum capabilities of the light hardware and the firmware configuration. Hopefully the device handler corrects for any oddities of the light, but most of the time they don’t. In this case, you’re best bet is to just use trial and error to find the right values for your intended light. If you want the SmartApp to have broader appeal, provide the option for the user to input their Hue/Sat values as opposed to giving generic options like red, blue, etc…


Thank you, I didn’t want to assume that the conversion from degrees to percent was simple division, but that works!

1 Like

That’s where you can get some device specific issues depending on the hardware/software/device handler interaction. Most device handlers I’ve seen convert the 0-100 based on whatever the min/max of the device is, so you should be ok assuming simple division. For instance, the ZigBee standard for hue uses a range from 0-255 (2-digit hexadecimal with FF usually reserved), so those device handlers typically do hue*255/100.