Measure perceptual color distance

Name the color-difference formula whenever the numeric result drives a decision.

CIEDE2000 2.04246
DeltaE94 6.02425
CMC 2:1 1.73874

The number depends on the algorithm

The same Lab pair produces materially different values under CIEDE2000, DeltaE94, and CMC 2:1. Store the algorithm beside the result.

Select the formula explicitly

Color::distance() defaults to CIEDE2000. Pass a supported algorithm name when your tolerance or domain requires another formula.

<?php

use PhpColor\Color\Color;
use PhpColor\Color\LabColor;

$a = new LabColor(50.0, 2.6772, -79.7751);
$b = new LabColor(50.0, 0.0, -82.7485);

printf("CIEDE2000 %.13f\n", Color::distance($a, $b));
printf("DeltaE94 %.13f\n", Color::distance($a, $b, 'DeltaE94'));
printf("CMC %.13f\n", Color::distance($a, $b, 'CMC'));

// CIEDE2000 2.0424596801566
// DeltaE94 6.0242477679966
// CMC 1.7387361057262
use PhpColor\Color\Color; use PhpColor\Color\LabColor; $a = new LabColor(50.0, 2.6772, -79.7751); $b = new LabColor(50.0, 0.0, -82.7485); printf("CIEDE2000 %.13f\n", Color::distance($a, $b)); printf("DeltaE94 %.13f\n", Color::distance($a, $b, 'DeltaE94')); printf("CMC %.13f\n", Color::distance($a, $b, 'CMC')); // CIEDE2000 2.0424596801566 // DeltaE94 6.0242477679966 // CMC 1.7387361057262

A distance needs a policy

The method returns a measurement, not an automatic acceptable or unacceptable verdict. Define thresholds for the material and task you are evaluating.

CIEDE2000The default general Lab color-difference formula.
DeltaE94A different formula with its own weighting model.
CMCThe default CMC alias uses the 2:1 acceptability parameters.
AlphaThese Lab distance calculations do not evaluate backdrop-dependent transparency.

Choose a next step

Measure with a named formula and an explicit tolerance