Name That Color
A command line tool that returns the color name of an Hex or RGB color value.
ntc is a free open source utility developed in PureBASIC (v5.42) by Tristano Ajmone in June 2016, and released under the MIT License.
- Ready to use binary for Windows 64bit available in release.
NOTE: I might get around to publish also binaries for Windows 32bit and Linux. In the meantime, if you can help, clone the repo and release binaries for other OSs’ (especially Mac, which I don’t have access to!) for the benefit of those who don’t have PureBASIC.
Graphics designers and web developers often need to find names for the colors they handle. Naming colors allows better communication between team members and with clients, especially when it boils down to chosing between similar colors. The problem is that there are thousands of color names out there, and most people only need to master a couple of hundred color names to cope with daily life. So, how can we name all those exotic hues, tints and shades we come across during our work?
Name That Color comes to our rescue: it accepts a color definition (hexadecimal or RGB) as input, and spits out the color name that resembles it most from a list of 1566 color name/value pairs.
It’s as simple as this:
$ ntc #ff4020 Pomegranate $ ntc 120,80,200 Fuchsia Blue
Ntc was designed keeping in mind how most people would use it in everyday situations. Its basic mode of operation is to simply receive a color value and return a name for it. Further options are available, for more accurate uses, up to scripted automation employment.
Full documentation available inside the binary file, just type
Bulding The Sources
You’ll need PureBASIC v5.42.
Should compile under Linux and Mac, but didn’t have a chance to test (and I don’t own a Mac), so feedback is most welcome for other OSs’.
Project file is included, but will need some tweaking for building under Windows 32, and it might be no good for Linux and Mac due difference in path formatting. Unfortunately PureBASIC’s project files are not version control friendly.
ntc.pb in Console + ASCII mode and you’re good to go.
Future Plans And Contributing
This first release was a bit of a rush thing, so I’ve left out of it quite a few ideas I wanted to add. But in the future I’m planning to expand ntc’s functionality, and also build a GUI version, and some tools to manage color names lists.
You are welcome to contribute to the project via issue requests, or by forking it and pull requesting.
How This Project Came About
So I started looking into the code of ntc js and ryanzec’s Node version of it, which lead me to look into the issue of color difference/similarity algorithms — at its core, ntc js takes an input color values and runs it against a list of color name/values pairs, looking for an exact match and, failing that, comparing the input (target) color against all color values in the list, returning the closest match it found.
I couldn’t figure out which algorithm ntc js uses — it seems to measures the euclidean distance between the two colors in both RGB and HSL format, and then calculates a mean of the two with a slant toward HSL — and attempts to contact Chirag Mehta via email failed. But I realized it wasn’t using dE00, which is considered today the most reliable formula for the task.
So, I decided to take on the task of recreating Name That Color using Mehta’s color names list and the dE00 algorithm. Which lead us directly to the due credits…
I expresses gratitude and attribute due credits to all those people whose work has rendered this project possible by sharing their source codes or by providing crucial information.
Source Code Reuse
“php-color-difference” by renasboy (no license claims) – ntc’s dE00 algorithm is a port of this PHP class.
Regarding the colors in this list, Chirag Mehta mentions in his credits the following sources:
“The Resene RGB Values List”, copyrighted to Resene Paints Ltd, 2001:
Wikipedia’s entries for “Lists of colors” and “List of Crayola crayon olors”:
[ above link now redirects to: ]
delta E Calculators – These online tools have been invaluable for testing accuracy of results during development:
EasyRGB – This website is a gold mine when it comes to digital colors math and formulas, providing lots of valuable pseudocode examples: