RGB triple of color name, version 2

Returns a Matlab RGB color specifier corresponding to a given color name (139 colors supported).
ダウンロード: 21.8K
更新 2009/7/5

ライセンスの表示

RGB = RGB('COLORNAME') returns the red-green-blue triple corresponding to the color named COLORNAME by the CSS3 proposed standard [1], which contains 139 different colors (an rgb triple is a 1x3 vector of numbers between 0 and 1). The color names are the ones accepted by almost all web browsers, for example Brown, DarkRed, SlateGray.

RGB CHART creates a figure window showing all the available colors with their names.

COLORNAME = RGB(r,g,b) and COLORNAME = RGB([r,g,b]) both find the name of the color with the triple that is closest to [r,b,g] (measured by sum of squares).

EXAMPLES
c = rgb('DarkRed') gives c = [0.5430 0 0]
c = rgb('Green') gives c = [0 0.5 0]
plot(x,y,'color',rgb('orange')) plots an orange line through x and y
rgb chart shows all the colors
cnam = rgb(0.8,0.3,0.3) gives cnam = 'IndianRed'

REFERENCES
[1] "CSS Color module level 3", W3C (World Wide Web Consortium) working draft 21 July 2008, http://www.w3.org/TR/css3-color.
[2] "Web colors", http://en.wikipedia.org/wiki/Web_colors

引用

Kristjan Jonasson (2024). RGB triple of color name, version 2 (https://www.mathworks.com/matlabcentral/fileexchange/24497-rgb-triple-of-color-name-version-2), MATLAB Central File Exchange. 取得済み .

MATLAB リリースの互換性
作成: R2008b
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
タグ タグを追加

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
バージョン 公開済み リリース ノート
1.1.0.0

VERSION 2 allows finding color name given rgb triple.

1.0.0.0