mattacosta/php-colordiff

This package is abandoned and no longer maintained. The author suggests using the mattacosta/php-colorspace package instead.

Provides functions to convert and compare colors.

v1.0.0 2017-11-18 01:06 UTC

This package is auto-updated.

Last update: 2022-03-07 02:02:48 UTC


README

Implements utility functions to compute the difference between colors and to convert between different color models, such as RGB and CIELAB.

For more information on delta E functions, see Color difference.

Example

$color1 = ['r' => 255, 'g' => 0, 'b' => 255];  // Magenta
$color2 = ['r' => 220, 'g' => 20, 'b' => 60];  // Crimson

$color1 = ColorDiff::xyz2cielab(ColorDiff::rgb2xyz($color1));
$color2 = ColorDiff::xyz2cielab(ColorDiff::rgb2xyz($color2));
$difference = ColorDiff::deltaE2000($color1, $color2);