Oolite Colour Specifiers
Colour specifiers are used to declare colours in material attribute dictionaries, and in other contexts such as lasers in shipdata.plist. Colour specifiers take any of several forms:
Named colours
The simplest form of colour specifier is a string containing a colour name. The following names are supported:
| Name | RGBA value |
|---|---|
| blackColor | 0, 0, 0, 1 |
| darkGrayColor | 1/3, 1/3, 1/3, 1 |
| grayColor | 1/2, 1/2, 1/2, 1 |
| lightGrayColor | 2/3, 2/3, 2/3, 1 |
| whiteColor | 1, 1, 1, 1 |
| redColor | 1, 0, 0, 1 |
| greenColor | 0, 1, 0, 1 |
| blueColor | 0, 0, 1, 1 |
| cyanColor | 0, 1, 1, 1 |
| yellowColor | 1, 1, 0, 1 |
| magentaColor | 1, 0, 1, 1 |
| orangeColor | 1, 1/2, 0, 1 |
| purpleColor | 1/2, 0, 1/2, 1 |
| brownColor | 0.6, 0.4, 0.2, 1 |
| clearColor | 0, 0, 0, 0 |
RGBA tuples
Colours may also be specified in RGB or RGBA (red, green, blue, alpha [opacity]). RGB or RGBA tuples may be specified as arrays or as strings separated by spaces. The values may range from 0 to 1 or 0 to 255. (If no value is greater than 1, 0–1 is assumed, otherwise 0–255.) Examples:
"1 1 0"– yellow"0 128 0 128"– medium green at 50% opacity(1, 0, 0)– red
RGBA dictionaries
Colours may also be specified as RGB[A] dictionaries. Accepted keys are red, green, blue and alpha (or opacity), all optional. Defaults are 0.0 for red, green and blue, 1.0 for alpha.
{
// Shade of cyan
blue = 0.8;
green = 0.8;
}
HSBA dictionaries
Colours may also be specified as dictionaries in the HSB colour space. Accepted keys are hue (hue angle in degrees, required), saturation, brightness (or value) and alpha (or opacity). The default for the optional keys is 1.0.
{
// Pale magenta
hue = 300;
saturation = 0.3;
}
Links
Colours can be viewed at https://rgbcolorpicker.com/0-1 and many other websites