编者注: This file was selected as MATLAB Central Pick of the Week
- Input color name matching is generally case-insensitive with optional spaces, except for some palettes where whitespace or CamelCase is significant. Diacritics and other special characters are optional. If no exact match is found then the color names are filtered for all matching characters and the color name with the closest Levenshtein distance is returned.
- Input RGB are matched to the closest palette colors using one of a number of standard color difference metrics. The supported color differences are: CIEDE2000, OkLab, DIN99, CIE94:1, CIE94:2 (default), CIE76 (i.e. CIELAB), CMC2:1, CMC1:1, and RGB.
- the color names (string array, or cell array of char vectors).
- a numeric array of the corresponding RGB values.
- COLORNAMES_CUBE shows palette colors in a 3D cube. The supported colorspaces: Lab, LCh, DIN99, HSV, OKLab, XYZ, and RGB.
- COLORNAMES_VIEW shows palette colors in 2D axes, and sorting them by various colorspace dimensions (e.g. Lab, XYZ, YUV, HSV, or RGB) or alphanumerically by color name.
- COLORNAMES_DELTAE creates a figure comparing the color difference metrics.
- COLORNAMES_SEARCH (>=R2023b) creates a figure with interactive real-time color name matching, demonstrating the filtering by character and closest name selection using Levenshtein distance.
引用格式
Stephen23 (2024). Convert between RGB and Color Names (https://www.mathworks.com/matlabcentral/fileexchange/48155-convert-between-rgb-and-color-names), MATLAB Central File Exchange. 检索时间: .
MATLAB 版本兼容性
平台兼容性
Windows macOS Linux类别
标签
致谢
参考作品: 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
启发作品: 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!版本 | 已发布 | 发行说明 | |
---|---|---|---|
7.0.1 | * Add PowerPoint palettes.
|
||
7.0.0 | * Faster and more flexible color name matching algorithm.
|
||
6.1.3 | * Error message improvements
|
||
6.1.2 | * fix description bullet points |
||
6.1.1 | * Correct description. |
||
6.1.0 | - Add palettes LeCorbusier, OsxCrayons, PWG, Wada, Werner.
|
||
6.0.0 | * Accept STRING class text inputs.
|
||
5.0.1 | Add notes on how to add a new color palette. |
||
5.0.0 | * Faster color name matching algorithm. Also more flexible, e.g.:
|
||
4.0.1 | * Improve layout of palette descriptions and error messages.
|
||
4.0.0 | * Simplify .mat file structure.
|
||
3.6.0 | * Add DIN99 colorspace for viewing and deltaE calculation.
|
||
3.5.3 | * Add "Thesaurus" and "Tableau" palettes.
|
||
3.5.2.1 | * Improve online description. |
||
3.5.2 | * Remove non-ASCII characters from file. |
||
3.5.1 | * Fixed missing variable in COLORNAMES_CUBE
|
||
3.5.0.0 | * VIEW: show RGB value with click on color name.
|
||
3.4.0.0 | * Change Lab illuminant to D65.
|
||
3.3.0.0 | * Add AmstradCPC palette.
|
||
3.2.0.0 | * Documentation changes. |
||
3.1.0.0 | * Add CIEDE2000 deltaE color distance calculation.
|
||
3.0.0.0 | * Total rewrite of the RGB matching algorithm.
|
||
2.1.0.0 | * Much more robust string matching using Levenshtein distance to pick closest colorname (Wagner–Fischer algorithm).
|
||
2.0.0.0 | * Add lots of colorschemes.
|
||
1.2.0.0 | * Add Alphabet and Kelly colorschemes. |
||
1.1.0.0 | - Downloadable as toolbox |
|
|
1.0.0.0 |