MATLAB function for intuitive RGB color values from XKCD
The rgb
function returns the RGB triple of the 949 most common names for colors, according to the results of an XKCD survey. A chart of color options can be found here.
RGB = rgb('Color Name')
RGB = rgb('Color Name 1','Color Name 2',...,'Color Name N')
RGB = rgb({'Color Name 1','Color Name 2',...,'Color Name N'})
RGB = rgb('Color Name')
returns the rgb triple of the color described by the string 'Color Name'
. Try any color name you can think of, it'll probably work.
RGB = rgb('Color Name 1','Color Name 2',...,'Color Name N')
returns an N by 3 matrix containing RGB triplets for each color name.
RGB = rgb({'Color Name 1','Color Name 2',...,'Color Name N'})
accepts list of color names as a character array.
Get the RGB values of chartreuse:
>> rgb('chartreuse')
ans =
0.76 0.97 0.04
Get the RGB values of multiple colors
>> myColors = {'leather','swamp','light bluish green','butterscotch','cinnamon','radioactive green'};
>> rgb_vals = rgb(myColors)
rgb_vals =
0.67 0.45 0.20
0.41 0.51 0.22
0.46 0.99 0.66
0.99 0.69 0.28
0.67 0.31 0.02
0.17 0.98 0.12
This function was written by Chad A. Greene using data from a survey designed by Randall Munroe.