View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from

5.0 | 1 rating Rate this file 4 Downloads (last 30 days) File Size: 5.02 KB File ID: #22325 Version: 1.0



matt dash (view profile)


Names a color based on its RGB-triple colorspec. Knows over 400 color names.

| Watch this File

File Information

RGB2NAME returns a string containing the name of the input RGB triple. (Or a cell array of strings if an array is input.) This is a "brute force" approach that contains a large list of colors and their names, and uses a very simple nearest neighbor search to find the named color that is closest to the input color.

The included list has more than 400 color names, and it performs pretty well. There are a few regions of the color space where it isn't great, particularly with low-saturation colors.

This is mostly just for kicks, but I made it for a GUI that needs to ask the user about unnamed hg objects, so instead i can describe them to the user by color. Like "...the graph with the light red and very dark green lines..."

There is also a demo included (requires java) that names colors selected by the user in a jcolorchooser.


This file inspired Convert Between Rgb And Color Names.

MATLAB release MATLAB 7.6 (R2008a)
Other requirements R2007a or later, or requires a bsxfun replacement. Demo requires java to be enabled, but main function does not.
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
28 May 2014 Abdus Samad

I searched this kind of thing for 3 hrs and found this great submission. Thanks to Mr. Matt Dash.

Contact us