PHP code example of mattacosta / php-colordiff
1. Go to this page and download the library: Download mattacosta/php-colordiff library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mattacosta / php-colordiff example snippets
$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);