Color
Any one of the following:
- Hexadecimal. A color represented as #RRGGBB; a hash sign followed by 6 hexadecimal digits, a pair for the intensity level 0 to 250 in hexadecimal of Red, Green and Blue. This is the same format used for describing colours in HTML. Example:
#A482BF
. The short form is also accepted, e.g. #f00 for #ff0000 - where the two hex characters of each per-color value are identical and the second character is omitted.Bare hex strings in action code - i.e. unquoted numbers preceded by a hash sign - are correctly identified as hex input values - Named Colours. The name of a colour that either comes pre-defined in Tinderbox, or which you have defined for this Tinderbox document using the Colors pane of the attribute palette. Examples: blue, red, minty-fresh-green. When setting a shade of a named colour in a string the shade value (lighter, darkest, etc.) comes before the colour, unlike listings in Info view and the Inspectors; thus "dark warm gray" not "warm gray dark", "light cyan" not "cyan light".
- HSV (Hue-Saturation-Value) value. Hue - a value from 0 to 360 degrees; Saturation and Value - a value from 0 to 100 percent. Enclosed in parentheses and preceded by 'hsv'. Examples:
"hsv(0,100,50)"
,"hsv(240,80,80)"
. - RGB (Red-Green-Blue). Intensity levels represented as integers from 0 to 250. Enclosed in parentheses and preceded by 'rgb'. Examples:
"rgb(0,0,0)"
and"rgb(68,153,68)"
. This should not be confused with the rgb() action operator (which sets a hex format value string (see first bullet above).
If no default value is specified, a Color type defaults to an empty string (which is treated by Tinderbox as the value 'normal'); in key attribute displays a white colour chip is displayed. In some cases, Tinderbox will show a dark red colour as a 'not initialised' colour value; it is hex colour code #6f0000, though its derivation as a value is not clear.
Note that as 8-bit colour settings are translated within the app into 16-bit colours, rounding errors can occur. So, in some cases - most likely using HSV and HSV based transforms - the values used might not correspond precisely to those set by the user.
When accessed via ^value()^ export code, it will return either a hex colour value or a named Tinderbox colour, depending on what is set for the destination attribute. By comparison, using the deprecated ^get()^ or ^getFor()^ export codes, the colour is always returned as a hex figure including a # prefix, e.g. "#FF9900".
Similarly, using format() with a colour attribute will always result in a hexadecimal value string regardless of the stored value. Thus it makes sense to export colour attributes as ^value(format($ColorAttr))^ or ^value($ColorAttr.format())^. However, note that coercing a default (blank) colour to a string value using format() or .format() will result in the colour value "#ffffff", which is not strictly the blank value. So, be wary of using that formatting as a means to check for a blank colour value; better is to use a short form Boolean test.