Colors

How to define a color.

The color of light is best represented in terms of hue, saturation, kelvin, and brightness components. Hue and saturation describe color where as kelvin describes warm and cool whites. Extra care should be given when converting between RGB and HSBK as RGB poorly represents the color of light.

  • `#ff0000` – Deep red, maximum brightness
  • `hue:120 saturation:1.0 brightness:0.5` – Deep green, 50% brightness
  • `kelvin:2700 brightness: 0.5` – Warm white (2700 K), 50% brightness
  • `rgb:0,255,255` – Cyan, 100% brightness
  • `kelvin:5000` – Set kelvin to cool white (5000 K) and saturation to 0 without affecting other components
  • `kelvin:2700 saturation:1` – Set kelvin to warm (2700 K) and saturation to 1
  • `brightness:0.75` – Set brightness to 75% without affecting other components
  • `saturation:0.25` – Set saturation to 25% without affecting other components
  • `red` – Sets color to red but doesn't affect brightness

One or many of the hue, saturation, kelvin, and brightness components can be combined to describe the desired color.

Formatting Colors

Format

Example

Notes

[name]

white, red, orange, yellow, cyan, green, blue, purple, or pink

Sets the hue and saturation components, but leaves brightness untouched.

hue:[0-360]

hue:120

Sets hue without affecting other components

saturation:[0.0-1.0]

saturation:0.5

Sets saturation without affecting other components

brightness:[0.0-1.0]

brightness:0.5

Sets brightness without affecting other components

kelvin:[1500-9000]

kelvin:5000

Sets kelvin to the given value and saturation to 0.0. Other components are not affected.

#RRGGBB

#ff0000

Automatically converts to HSBK

rgb:[0-255],[0-255],[0-255]

rgb:255,255,0

Automatically converts to HSBK

Validating Colors

If you need to validate user input, you can use the Validate Color endpoint.