Convert between RGB and Color Names
Editor's Note: This file was selected as MATLAB Central Pick of the Week
- Input RGB closest palette match is found using CIEDE2000, CIE94 (default), CIE76, DIN99, CMCl:c, or RGB color difference (deltaE).
- Input color name matching is case insensitive with optional spaces, except for some palettes where CamelCase is significant.
- the color names (string array or cell array of char vectors).
- a numeric array of the corresponding RGB values.
- COLORNAMES_CUBE shows the colors from any palette in a 3D cube (Lab, LCh, DIN99, HSV, XYZ, or RGB).
- COLORNAMES_VIEW shows the colors from any palette in 2D axes, and sorting them by different color space values (Lab, XYZ, YUV, HSV, or RGB).
- COLORNAMES_DELTAE creates a figure comparing the different color difference calculations (CIEDE2000, CIE94, CIE76, DIN99, CMCl:c, or RGB). For more information: https://en.wikipedia.org/wiki/Color_difference
Cite As
Stephen23 (2022). Convert between RGB and Color Names (https://www.mathworks.com/matlabcentral/fileexchange/48155-convert-between-rgb-and-color-names), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Acknowledgements
Inspired by: rgb.m, name2rgb, Color name identification: fuzzycolor, str2rgb, GETRGB (v1.0), rgb2name, GNU Emacs Color matrix, RGB.m, RGB triple of color name, version 2, Color Checker Chart, CubeHelix Colormap Generator: Beautiful and Versatile!, ColorBrewer: Attractive and Distinctive Colormaps, Intuitive RGB color values from XKCD, rgbmap color maps, alphabet, generate_ishihara(image_name, varargin), colors(name), rgb2map, color, Color segmentation by Delta E color difference
Inspired: Maximally Distinct Color Generator, colorpicker, MatPlotLib Perceptually Uniform Colormaps, Message Logger
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.