Color Values in SenseTalk
A color can be represented in SenseTalk as a combination of component values in any of several different formats.
Supported Color Formats
The recognized formats are listed in the following table:
Color Format | Example Value | Description |
---|---|---|
Basic | 128,0,64 | Red, green, and blue values from 0 to 255 |
Alpha | 128,0,64,255 | Red, green, blue, and alpha values from 0 to 255 |
HTML | #800040 | Red, green, and blue values in hexadecimal form as used in web pages |
W | W, 0.241 | White value from 0 (black) to 1 (white)k |
WA | WA, 0.241, 1.000 | White and alpha values from 0 to 1 |
RGB | RGB, 0.5, 0, 0.25 | Red, green, and blue values from 0 to 1 |
RGBA | RGBA, 0.5, 0.0, 0.25, 1.0 | Red, green, blue, and alpha values from 0 to 1 |
HSB | HSB, 0.917, 1.0, 0.5 | Hue, saturation, and brightness values from 0 to 1 |
HSBA | HSBA, 0.917, 1.0, 0.5, 1.0 | Hue, saturation, brightness and alpha values from 0 to 1 |
CMYK | CMYK, 0.143, 0.942, 0.225, 0.274 | Cyan, magenta, yellow, and black values from 0 to 1 |
CMYKA | CMYKA, 0.143, 0.942, 0.225, 0.274, 1.000 | Cyan, magenta, yellow, black, and alpha values from 0 to 1 |
In addition, a number of color names are recognized, as defined by the namedColors
global property.
The default color format, known as the Basic
format, is a list of three numbers with values in the range 0 to 255, indicating the amounts of red, green, and blue that compose the color. The Alpha
format adds a fourth number, known as the alpha value, that represents the opacity of the value, for systems that can work with partially-transparent colors. An alpha value of zero represents clear.
The HTML format is a single value consisting of a pound sign (#) followed by two hexadecimal digits each for the red, green, and blue components of the color. Each of the other formats is a list beginning with a format code, followed by numeric values in the range 0.0 to 1.0 representing the amount of each component in a particular color model.
When evaluating a value as a color, SenseTalk can accept either a list of appropriate values, or a text list (a text string consisting of values separated by commas).