M-File Help: colorname | View code for colorname

# colorname

Map between color names and RGB values

rgb = colorname(name) is the rgb-tristimulus value (1x3) corresponding to the color specified by the string name. If rgb is a cell-array (1xN) of names then rgb is a matrix (Nx3) with each row being the corresponding tristimulus.

XYZ = colorname(name, 'xyz') as above but the XYZ-tristimulus value corresponding to the color specified by the string name.

XY = colorname(name, 'xy') as above but the xy-chromaticity coordinates corresponding to the color specified by the string name.

name = colorname(rgb) is a string giving the name of the color that is closest (Euclidean) to the given rgb-tristimulus value (1x3). If rgb is a matrix (Nx3) then return a cell-array (1xN) of color names.

name = colorname(XYZ, 'xyz') as above but the color is the closest (Euclidean) to the given XYZ-tristimulus value.

name = colorname(XYZ, 'xy') as above but the color is the closest (Euclidean) to the given xy-chromaticity value with assumed Y=1.

## Notes

- Color name may contain a wildcard, eg. "?burnt"
- Based on the standard X11 color database rgb.txt.
- Tristimulus values are in the range 0 to 1

© 1990-2014 Peter Corke.