Is there an easy way to compare how close two colors are to each other?

Delta-e, is a single number that represents the perceived 'distance' between two colors. The lower the number, the more similar the colors are to the human eye.

There are a few different ways to calculate it...CIE76 (aka CIE 1976 or dE76) being the most popular.

  • CIE76
  • CMC l:c
  • dE94
  • dE2000

Each one goes about things in a different way, but for the most part they all require you to convert to a better (for comparison) color model than RGB.

For CIE76 you basically just convert your colors to the LAB color space, then compute the 3 dimensional distance between them.

Wikipedia has all the formulae: http://en.wikipedia.org/wiki/Color_difference

You can check your work with online color calculators:

  • CIE76
  • CMC l:c

You probably want to convert the colors to an HSL model (Hue, Saturation, Lightness) and then compare the values within thresholds in the order HSL. If the hue is within a tolerance deemed as "close", then check the "closeness" of the saturation, and then the lightness.


I'm not sure of any algorithms, you may want to consider converting RGB (Red, Green, Blue) values in to HSB (Hue, Saturation, Brightness).

Hue is essentially "color", so you can compare simply on how close the Hue values are.

See http://en.wikipedia.org/wiki/HSV_color_space