In color science, **color difference** or **color distance** is the separation between two colors. This metric allows quantified examination of a notion that formerly could only be described with adjectives. Quantification of these properties is of great importance to those whose work is color-critical. Common definitions make use of the Euclidean distance in a device-independent color space.

As most definitions of color difference are distances within a color space, the standard means of determining distances is the Euclidean distance. If one presently has an RGB (red, green, blue) tuple and wishes to find the color difference, computationally one of the easiest is to consider *R*, *G*, *B* linear dimensions defining the color space.

A very simple example can be given between the two colors with RGB values (0, 64, 0) ( ) and (255, 64, 0) ( ): their distance is 255. Going from there to (255, 64, 128) ( ) is a distance of 128.

When we wish to calculate distance from the first point to the third point (i.e. changing more than one of the color values), we can do this:

When the result should be computationally simple as well, it is often acceptable to remove the square root and simply use

This will work in cases when a single color WAS to be compared to a single color and the need is to simply know whether a distance is greater. If these squared color distances are summed, such a metric effectively becomes the variance of the color distances.

There have been many attempts to weigh RGB values to better fit human perception, where the components are commonly weighted (red 30%, green 59%, and blue 11%), however, these are demonstrably^{[citation needed]} worse at color determinations and are properly the contributions to the brightness of these colors, rather than to the degree to which human vision has less tolerance for these colors. The closer approximations would be more properly (for non-linear sRGB, using a color range of 0–255):^{[1]}

where:

One of the better low-cost approximations, sometimes called "redmean", combines the two cases smoothly:^{[1]}

There are a number of color distance formulae that attempt to use color spaces like HSV or HSL with the hue represented as a circle, placing the various colors within a three-dimensional space of either a cylinder or cone, but most of these are just modifications of RGB; without accounting for differences in human color perception, they will tend to be on par with a simple Euclidean metric.^{[citation needed]}

CIELAB and CIELUV are relatively perceptually-uniform color spaces and they have been used as spaces for Euclidean measures of color difference. The CIELAB version is known as CIE76. However, the non-uniformity of these spaces were later discovered, leading to the creation of more complex formulae.

See also: § Tolerance |

Uniform color space: a color space in which equivalent numerical differences represent equivalent visual differences, regardless of location within the color space. A truly uniform color space has been the goal of color scientists for many years. Most color spaces, though not perfectly uniform, are referred to as uniform color spaces, since they are more nearly uniform when compared to the chromaticity diagram.

— X-rite glossary^{[2]}

A uniform color space is supposed to make a simple measure of color difference, usually Euclidean, "just work". Color spaces that improve on this issue include CAM02-UCS, CAM16-UCS, and J_{z}a_{z}b_{z}.^{[3]}

In 2019 a new standard for WCG and HDR was introduced, since CIEDE2000 was not adequate for it: CIEDE2000 is not reliable below 1 cd/m^{2} and has not been verified above 100 cd/m^{2}; in addition, even in BT.709 blue primary CIEDE2000 is underpredicting the error.^{[4]} Δ*E*_{ITP} is scaled so that a value of 1 indicates the potential of a just noticeable color difference. The Δ*E*_{ITP} color difference metric is derived from display referenced IC_{T}C_{P}, but XYZ is also available in the standard. The formula is a simply scaled Euclidean distance:^{[5]}

where the components of this "ITP" is given by

*I*=*I*,*T*= 0.5*C*_{T},*P*=*C*_{P}.

The Euclidean measure is known to work poorly on large color distances (i.e. more than 10 units in most systems). A hybrid approach where a taxicab distance is used between the lightness and the chroma plane, , is shown to work better on CIELAB.^{[6]}

This section is missing information about acceptability difference values in industry. Please expand the section to include this information. Further details may exist on the talk page. (July 2021)

This section may require cleanup to meet Wikipedia's quality standards. The specific problem is: Should reorder chronologically (move CMC between 76 and 94, then rephrase accordingly) as it looks like an inspiration for the move to LCh. Please help improve this section if you can. (February 2022) (Learn how and when to remove this template message)

The International Commission on Illumination (CIE) calls their distance metric Δ*E** (also inaccurately called *dE**, dE, or "Delta E") where delta is a Greek letter often used to denote difference, and **E** stands for *Empfindung*; German for "sensation". Use of this term can be traced back to Hermann von Helmholtz and Ewald Hering.^{[7]}^{[8]}

Perceptual non-uniformities in the underlying CIELAB color space have led to the CIE refining their definition over the years, leading to the superior (as recommended by the CIE) 1994 and 2000 formulas.^{[9]} These non-uniformities are important because the human eye is more sensitive to certain colors than others. CIELAB metric is used to define color tolerance of CMYK solids. A good metric should take this into account in order for the notion of a "just noticeable difference" (JND) to have meaning. Otherwise, a certain Δ*E* may be insignificant between two colors in one part of the color space while being significant in some other part.^{[10]}

All Δ*E** formulae are originally designed to have the difference of 1.0 stand for a JND. This convention is generally followed by other perceptual distance functions such as the aforementioned Δ*E*_{ITP}.^{[11]} However, further experimentation may invalidate this design assumption, the revision of CIE76 Δ*E*^{*}_{ab} JND to 2.3 being an example.^{[12]}

The 1976 formula is the first formula that related a measured color difference to a known set of CIELAB coordinates. This formula has been succeeded by the 1994 and 2000 formulas because the CIELAB space turned out to be not as perceptually uniform as intended, especially in the saturated regions. This means that this formula rates these colors too highly as opposed to other colors.

Given two colors in CIELAB color space, and , the CIE76 color difference formula is defined as:

corresponds to a JND (just noticeable difference).^{[12]}

The 1976 definition was extended to address perceptual non-uniformities, while retaining the CIELAB color space, by the introduction of application-specific weights derived from an automotive paint test's tolerance data.^{[11]}

Δ*E* (1994) is defined in the L*C*h* color space with differences in lightness, chroma and hue calculated from L*a*b* coordinates. Given a reference color^{[a]} and another color , the difference is^{[13]}^{[14]}^{[15]}

where

and where *k _{C}* and

graphic arts textiles 1 2 0.045 0.048 0.015 0.014

Geometrically, the quantity corresponds to the arithmetic mean of the chord lengths of the equal chroma circles of the two colors.^{[16]}

Since the 1994 definition did not adequately resolve the perceptual uniformity issue, the CIE refined their definition, adding five corrections:^{[17]}^{[18]}

- A hue rotation term (R
_{T}), to deal with the problematic blue region (hue angles in the neighborhood of 275°):^{[19]} - Compensation for neutral colors (the primed values in the L*C*h differences)
- Compensation for lightness (S
_{L}) - Compensation for chroma (S
_{C}) - Compensation for hue (S
_{H})

**Note:**The formulae below should use degrees rather than radians; the issue is significant for*R*._{T}- The
*k*,_{L}*k*, and_{C}*k*are usually unity._{H}

**Note:**The inverse tangent (tan^{−1}) can be computed using a common library routine`atan2(b, a′)`

which usually has a range from −π to π radians; color specifications are given in 0 to 360 degrees, so some adjustment is needed. The inverse tangent is indeterminate if both*a′*and*b*are zero (which also means that the corresponding*C′*is zero); in that case, set the hue angle to zero. See Sharma 2005, eqn. 7.**Note:**The example above expects the parameter order of atan2 to be`atan2(y, x)`

. See implementation in^{[20]}

**Note:**When either*C′*_{1}or*C′*_{2}is zero, then Δh′ is irrelevant and may be set to zero. See Sharma 2005, eqn. 10.

**Note:**When either*C′*_{1}or*C′*_{2}is zero, then H′ is*h′*_{1}+*h′*_{2}(no divide by 2; essentially, if one angle is indeterminate, then use the other angle as the average; relies on indeterminate angle being set to zero). See Sharma 2005, eqn. 7 and p. 23 stating most implementations on the internet at the time had "an error in the computation of average hue".

In 1984, the Colour Measurement Committee of the Society of Dyers and Colourists defined a difference measure, also based on the L*C*h color model. Named after the developing committee, their metric is called **CMC l:c**. The quasimetric has two parameters: lightness (l) and chroma (c), allowing the users to weight the difference based on the ratio of l:c that is deemed appropriate for the application. Commonly used values are 2:1^{[21]} for acceptability and 1:1 for the threshold of imperceptibility.

The distance of a color to a reference is:^{[22]}

CMC l:c is designed to be used with D65 and the CIE Supplementary Observer.^{[23]} As with CIE94, this formula defines a quasimetric because it violates symmetry: parameter T is based on the hue of the reference alone.

See also: Uniform color space |

**Tolerancing** concerns the question "What is a set of colors that are imperceptibly/acceptably close to a given reference?" If the distance measure is * perceptually uniform*, then the answer is simply "the set of points whose distance to the reference is less than the just-noticeable-difference (JND) threshold". This requires a perceptually uniform metric in order for the threshold to be constant throughout the gamut (range of colors). Otherwise, the threshold will be a function of the reference color—cumbersome as a practical guide.

In the CIE 1931 color space, for example, the tolerance contours are defined by the MacAdam ellipse, which holds L* (lightness) fixed. As can be observed on the adjacent diagram, the ellipses denoting the tolerance contours vary in size. It is partly this non-uniformity that led to the creation of CIELUV and CIELAB.

More generally, if the lightness is allowed to vary, then we find the tolerance set to be ellipsoidal. Increasing the weighting factor in the aforementioned distance expressions has the effect of increasing the size of the ellipsoid along the respective axis.^{[24]}