Code covered by the BSD License  

Highlights from
Intuitive RGB color values from XKCD

5.0

5.0 | 3 ratings Rate this file 33 Downloads (last 30 days) File Size: 84.8 KB File ID: #46872
image thumbnail

Intuitive RGB color values from XKCD

by

 

05 Jun 2014 (Updated )

RGB triplets for 949 colors, by how they're perceived on a computer monitor and their common names.

| Watch this File

File Information
Description

This function returns the RGB triplet for almost any color. And unlike the way colors are somewhat officially defined (http://en.wikipedia.org/wiki/Web_colors), this data set describes returns values for the ways that colors are actually perceived on computer monitors. Color names are intuitive because they are based on a survey of over 200,000 user sessions, wherein respondents were shown colors and asked to fill in their word for that color. You won't find "puke green" on Wikipedia's list of web colors, despite the fact that it's a color name that people use and understand.
Data come from an XKCD survey described here: http://blog.xkcd.com/2010/05/03/color-survey-results/
A chart of available colors and their most common names can be found here: http://xkcd.com/color/rgb/

Syntax
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'})

Description
RGB = rgb('Color Name') returns the RGB triplet for a color described by 'Color Name'.

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.

Acknowledgements

Rgb Triple Of Color Name, Version 2, Generate Maximally Perceptually Distinct Colors, Cbrewer : Colorbrewer Schemes For Matlab, Xkcdify, and Rgb2hex And Hex2rgb inspired this file.

This file inspired Rgbmap Color Maps, Post Glacial Rebound, Cubehelix Colormaps, Color Brewer: Attractive And Distinctive Colormaps, and Name That Color! Rgb < > Colorname Converter.

Required Products MATLAB
MATLAB release MATLAB 8.0 (R2012b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (5)
08 Aug 2014 Stephen Cobeldick

PPS: the input checking <iscellstr(ColorNames)==0 && iscellstr({ColorNames})==1> is equivalent to <ischar(ColorNames)> :)

08 Aug 2014 Stephen Cobeldick  
08 Aug 2014 Chad Greene

Great catch Stephen, thanks for bringing this to my attention. I neglected to include hex2rgb in yesterday's update. It's now included.

08 Aug 2014 Stephen Cobeldick

PS: although the function "hex2rgb" should either be included, or otherwise clearly indicated that it is required!

24 Jun 2014 Stephen Cobeldick

This is a very tidy submission. The original XKCD survey makes for a highly entertaining read, and this submission (an import of the survey results into MATLAB) is a great addition by Chad Greene to the MATLAB color handling functions!

Updates
05 Jun 2014

Link to hex2rgb, rgb2hex.

07 Aug 2014

Now supports multiple inputs and offers help for misspelled inputs.

08 Aug 2014

Included hex2rgb function and improved error handling.

Contact us