Let's say you have a color, and you want to find the closest match in defined color scheme set. The first problem is defining what closest means. It's not a simple problem to solve.
There are a number of approaches to this, the simplest being to measure the euclidean distance between two colors in a 3D color space - for example RGB, HSL, HSV etc. Here's and article that shows how to do that.
However, these mathematical approaches do not really adjust for color perception. Another color model CIEL*a*b*, has used various algorithms over the years to create better matches to take account of perceived color differences.
Amazingly, it works very well. In Looking up color table I've built up a table of schemes such as Pantone, dulux etc through various web scraping sessions, and now have getting on for 10,000 named colors in that library. To test it, I generate some random colors, then look up the closest in each of the schemes in my color table. Here's the result - I tried to find a match for the first column of random numbers in all of the color table, and also in each of the individual color schemes. Their names are shown along with their color. Pretty close in all cases. Of course the html color scheme is rather short, but still close results.
It's not pretty, but here are the main functions in color match algorithm.
and here' the test procedure that generated the above
Services > Desktop Liberation - the definitive resource for Google Apps Script and Microsoft Office automation > Color Fiesta >