-
Notifications
You must be signed in to change notification settings - Fork 45
RGB Channels color formats
Wojciech Frącz edited this page Jun 24, 2019
·
10 revisions
API accepts the following formats of giving color value for an RGB channel.
- RGB as an integer in
color
parameter and an optionalcolor_brightness
parameter. Thecolor
must be between 1 and0xFFFFFF
(16777215) value. Ifcolor_brightness
is ommitted, thecolor_brightness
value from current state will be used. - RGB in hex format in
color
parameter and an optionalcolor_brightness
parameter. All other rules from the point above apply. - Hue value as an integer in
hue
parameter with an optionalcolor_brightness
parameter. Thehue
value must be in 0-359 range. - RGB as an objec in
rgb
parameter. It must containred
,green
andblue
keys that contain values in 0-255 range. - HSV as an object in
hsv
parameter. It must containhue
key with value in 0-359 range andsaturation
andvalue
keys with values in 0-100 range. - Setting random color with
random
string passed incolor
parameter, with an optionalcolor_brightness
parameter.
You may use only one color format in a single request. Fail to do so will result in an API error.
The table below shows the valid requests you may send to the API and the resulting color values that are sent to the IO Device. Please notice, that the device always receives only color
and color_brightness
values, regardless of the format you used during the execution SET_RGBW_PARAMETERS
channel action.
API Request | IO Device receives |
---|---|
{"color": "0xFF0000"} |
{"color": "0xFF0000", "color_brightness": <<same as before>>} |
{"color": 16711680} |
{"color": "0xFF0000", "color_brightness": <<same as before>>} |
{"rgb": {"red": 255, "green": 0, "blue": 0}} |
{"color": "0xFF0000", "color_brightness": 100} |
{"color": "0xAA0000"} |
{"color": "0xAA0000", "color_brightness": <<same as before>>} |
{"color": "0xAA0000", "color_brightness": 67} |
{"color": "0xAA0000", "color_brightness": 67} |
{"color": "0xFF0000", "color_brightness": 67} |
{"color": "0xFF0000", "color_brightness": 67} |
{"rgb": {"red": 170, "green": 0, "blue": 0}} |
{"color": "0xFF0000", "color_brightness": 67} |
{"hue": 0} |
{"color": "0xFF0000", "color_brightness": <<same as before>>} |
{"hue": 0, "color_brightness": 67} |
{"color": "0xFF0000", "color_brightness": 67} |
{"hsv": {"hue": 0, "saturation": 100, "value": 100}} |
{"color": "0xFF0000", "color_brightness": 100} |
{"hsv": {"hue": 0, "saturation": 100, "value": 67}} |
{"color": "0xFF0000", "color_brightness": 67} |
{"hsv": {"hue": 139, "saturation": 90, "value": 82}} |
{"color": "0x15D151", "color_brightness": 82} |
{"color": "random"} |
{"color": "0x87CEFA", "color_brightness": <<same as before>>} (example) |
{"color": "random", "color_brightness": 67} |
{"color": "0x87CEFA", "color_brightness": 67} (example) |