Best algorithm for matching colours.
Convert all of the colors to the CIE Lab color space and compute the distance in that space deltaE = sqrt(deltaL^2 + deltaA^2 + deltaB^2) Colors with the lowest deltaE are the most perceptually similar to each other.