ColorDistance
Utility for calculating perceptual distance between colors.
Supports various algorithms including CIEDE2000, DeltaE94, and CMC.
Methods
calculate
static
public static function calculate(ColorInterface $a, ColorInterface $b, ColorDistanceInterface|string $algorithm): float
Calculate color distance using a specific algorithm.
Supported algorithms:
- 'CIEDE2000' or 'DE2000': Most accurate modern formula
- 'DeltaE94' or 'DE94': Improved 1994 formula
- 'CMC' or 'CMC(2:1)': UK textile industry standard (acceptability)
- 'CMC(1:1)': CMC perceptibility variant
Parameters
| Name | Type | Default |
|---|---|---|
$a |
ColorInterface | - |
$b |
ColorInterface | - |
$algorithm |
ColorDistanceInterface|string | "CIEDE2000" |
deltaE
static
public static function deltaE(ColorInterface $a, ColorInterface $b): float
Calculate perceptual color distance using the CIEDE2000 algorithm.
Parameters
| Name | Type | Default |
|---|---|---|
$a |
ColorInterface | - |
$b |
ColorInterface | - |