Darwin Help

Back to Index

RGB_string

Function RGB_string - convert an RGB vector into a color name

Calling Sequence  RGB_string(rgb)
RGB_string(r,g,b)
Parameters
NameTypeDescription

rgb list(nonnegative)an RGB vector of length 3
r nonnegativeintensity for red (0..1)
g nonnegativeintensity for green (0..1)
b nonnegativeintensity for blue (0..1)
Return Type  string
Synopsis This function converts a 3 value RGB vector into a color name. 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 matching is approximate and the result is the one which is closest in euclidean distance to one in the table. About 650 colours are known to this function. The full list can be found at lib/Color.
Examples
> RGB_string([0,0,0]);
black
> RGB_string(0.5,1,0);
chartreuse
> RGB_string(.8,.4,.1);
chocolate3
See also Color,   DrawTree,   string_RGB