Is there a list of all color long names?
290 views (last 30 days)
Monika Jaskolka on 30 Jan 2018
Information on Matlab's color specification describes 8 basic colors and states that, "... long names are character vectors that specify one of eight predefined colors." https://www.mathworks.com/help/matlab/ref/colorspec.html
However, there are other long names available: lightblue, darkblue, darkgreen, purple, orange, gray, etc. Is there a comprehensive list of all available color names?
Edit: I am using the colors with Simulink, specifically to set the ForegroundColor and BackgroundColor parameters of blocks with set_param(). It is also possible to do this manually via the Context Menu, where some of the colors are listed. Purple and darkblue are not listed in the menu, but are valid colors:
Walter Roberson on 30 Jan 2018
None of those other colors are accepted by MATLAB color specifications.
There are a number of lists. My favorite is https://blog.xkcd.com/2010/05/03/color-survey-results/ but see also https://en.wikipedia.org/wiki/List_of_colors:_A%E2%80%93F
More Answers (3)
Jan on 30 Jan 2018
Edited: Jan on 30 Jan 2018
While I do not know the list of names defined in Matlab, you can find tools for getting the RGB values for color names in the FileExchange:
- https://www.mathworks.com/matlabcentral/fileexchange/46872-intuitive-rgb-color-values-from-xkcd . See also https://xkcd.com/color/rgb/
This seems to be an interesting problem for the FileExchange, like progressbars and recursive dir commands.
If you are looking for the color names recognized my Matlab directly, you have to search in the documentation:
I found a hint, that the LaTeX colors are meant. Then https://en.wikibooks.org/wiki/LaTeX/Colors should work.
In theory we could check the code of Matlab for a list of defined color names, but this would be reverse engineering, which is forbidden by the license conditions.
Steven Lord on 30 Jan 2018
"However, there are other long names available: lightblue, darkblue, darkgreen, purple, orange, gray, etc. "
How are you using those 'other long names'? Did you perhaps download an add-on that defines functions by those names to return an RGB value? You can check that using the which function. gray is a function that returns a colormap matrix, but I don't believe the others exist.
>> plot(1:10, 1:10, 'Color' ,'lightblue')
Error using plot
Specified character vector is an invalid color value.
You can define a variable or a function named lightblue and then use it, but I wouldn't call that an "available color name".
lightblue = [0.8 0.8 1];
plot(1:10, 1:10, 'Color', lightblue)