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.