Is there a list of all color long names?

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:

 Accepted Answer

None of those other colors are accepted by MATLAB color specifications.

8 Comments

For Simulink the list is shown at
Possible color values are 'black', 'white', 'red', 'green', 'blue', 'cyan', 'magenta', 'yellow', 'gray', 'lightBlue', 'orange', 'darkGreen'.
Thanks Walter. Other colors like purple, brown, darkblue, and darkyellow are all valid colors for BackgroundColor and ForegroundColor. I was just wondering if there was a way to figure out the complete list. So far I have been lucky with just guessing color names.
darkBlue
darkGreen
darkSalmon
darkYellow
paleyellow
smahtGuide
teal
and possibly others. These were found by trial and error.
smahtGuide appears to be a pale blue.
Smahtguide, that's a great Boston accent Easter egg!
lightSeaGreen lightBlue gray green darkBlue darkGreen darkSalmon darkYellow cyan white brown blueViolet black
I do not have time to format or do more checking at the moment. libmwsl_graphical_classes
Thanks for looking into this. I checked color names from LaTeX, HTML, and Wikipedia (A-F, G-M, N-Z). Combining your lists with mine, the colors which work as Simulink block ForegroundColor/ BackgroundColor values in 2017b are:
Black
Blue
BlueViolet
Brown
Cyan
DarkBlue
DarkGreen
DarkMagenta
DarkSalmon
DarkYellow
Gray
Green
LightBlue
LightSeaGreen
Magenta
Orange
PaleYellow
Purple
Red
SmahtGuide
White
Yellow
Teal did not work for me.
teal worked for me, for a Simulink.Annotation object . Might be a version difference.
'auto' is also accepted.
I was not able to scrape anything else.

Sign in to comment.

More Answers (3)

Jan
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:
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:
docsearch darkgreen
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.

3 Comments

Thanks Jan. I wrote a quick script and out of the 67 LaTeX colors, 12 were valid and could be used as the BackgroundColor for a Simulink block.
colorOk =
1×12 cell array
{'Blue'} {'BlueViolet'} {'Brown'}
{'Cyan'} {'Green'} {'Gray'}
{'Magenta'} {'Orange'} {'Purple'}
{'Red'} {'White'} {'Yellow'}
I was interested to see that BlueViolet is a valid name. Searching the documentation did not yield useful results.
I suppose I could continue to try various common color names to see which are valid, but the purpose of my original question was to see if a list like that already existed. As Walter pointed out, a list of the usual BackgroundColor names are given here: https://www.mathworks.com/help/simulink/slref/common-block-parameters.html, but other colors like BlueViolet, Purple, DarkYellow, DarkBlue, Brown, etc. also work. Evidently, this does not seem to be documented anywhere.
If it is not documented, you cannot be sure, if it is backward and forward compatible. I've suggested the tool from the FileExchange to convert a known list of color names to RGB values, which work with all Matlab versions for sure. You can insert the results in the field for selecting a "Custom" color.
Stephen23
Stephen23 on 3 Oct 2018
Edited: Stephen23 on 5 Oct 2018
"This seems to be an interesting problem for the FileExchange, like progressbars and recursive dir commands."
And of course writing a simple cell array of such names is trivially easy (and that is all some of those submissions are). However anyone wanting to write more than just a simple "cell array of names", e.g. by matching closest RGB colors to get the colornames, will be confronted with a challenge: how to define what the closest colors means mathematically... and they will find that there are standard metrics that define the perceptual differences between colors:
Each of those metrics behaves differently, depending on the colors and the "distances" involved. There is no perfect metric, but some are definitely better than others. Most FEX submissions do not even bother, and just rely on comparing RGB (ouch!).
"I found a hint, that the LaTeX colors are meant..."
Neither TeX nor LaTeX define any colors, but the commonly used packages color and xcolor certainly do. You will also find xcolor fully supported in my FEX submission, together with the named MATLAB colors, dvips colors, X11 colors, CSS colors, and many others:

Sign in to comment.

color (download link) converts color name or hexadecimal color code to an rgb triplet.
"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)

1 Comment

Sorry I didn't mention how I am using these colors originally. I have updated the original question with this info.
I am using the colors with Simulink as values for the ForegroundColor and BackgroundColor parameters of blocks. Using which on these colors does not find them.

Sign in to comment.

Categories

Products

Asked:

on 30 Jan 2018

Commented:

on 4 Jun 2026 at 18:43

Community Treasure Hunt

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

Start Hunting!