Difference between revisions of "Oolite Colour Specifiers"
Wildeblood (talk | contribs) (Page created. CORRECTIONS INVITED.) |
Wildeblood (talk | contribs) m (→HSBA dictionaries) |
||
| Line 56: | Line 56: | ||
==== HSBA dictionaries ==== | ==== HSBA dictionaries ==== | ||
| − | + | Colours may also be specified as dictionaries in the [http://en.wikipedia.org/wiki/HSB_colour_space 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 | // Pale magenta | ||
Revision as of 05:24, 11 August 2025
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 |
| lightGrayColor | 2/3, 2/3, 2/3, 1 |
| whiteColor | 1, 1, 1, 1 |
| grayColor | 1/2, 1/2, 1/2, 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 [transparency]). 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
Just in case you’re unsure of the order the RGB[A] components come in, you can use a dictionary:
{
blue = 0.8;
green = 0.8;
}
Accepted keys are red, green, blue and alpha (or opacity), all optional (default: 0.0 for red, green and blue, 1.0 for alpha).
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;
}