Darwin Help

Back to Index

string_RGB

Function string_RGB - convert a color name into an RGB vector

Calling Sequence  string_RGB(s)
Parameters
NameTypeDescription

s stringan color name without spaces
Return Type  [nonnegative, nonnegative, nonnegative]
Synopsis This function converts a color name into a 3 value RGB vector. The vector contains the values for red, green and blue in a scale of 0 to 1. Black is [0,0,0] and white is [1,1,1]. The name matching is case independent and it tolerates up to two errors. About 650 colours are known to this function. The full list can be found at lib/Color.
Examples
> string_RGB(MidnightBlue);
[0.09803922, 0.09803922, 0.4392]
> string_RGB(midnightBLAU);
[0.09803922, 0.09803922, 0.4392]
> string_RGB(chocolate);
[0.8235, 0.4118, 0.1176]
See also Color,   DrawTree,   RGB_string