PHP code example of itwmw / color-difference
1. Go to this page and download the library: Download itwmw/color-difference 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/ */
itwmw / color-difference example snippets
use Itwmw\ColorDifference\Color;
use Itwmw\ColorDifference\Lib\RGB;
use Itwmw\ColorDifference\Support\CIE94;
use Itwmw\ColorDifference\Support\CMC;
$color = new Color(new RGB(255, 183, 255));
$color2 = new Color(new RGB(55, 65, 53));
echo('Din99:' . $color->getDifferenceDin99($color2) . "\n");
echo('CIE76:' . $color->getDifferenceCIE76($color2) . "\n");
echo('CIE94-GraphicArts:' . $color->getDifferenceCIE94($color2, CIE94::GraphicArts) . "\n");
echo('CIE94-Textiles:' . $color->getDifferenceCIE94($color2, CIE94::Textiles) . "\n");
echo('CMC-Acceptability:' . $color->getDifferenceCMC($color2, CMC::Acceptability) . "\n");
echo('CMC-Imperceptibility:' . $color->getDifferenceCMC($color2, CMC::Imperceptibility) . "\n");
echo('CIEDE2000:' . $color->getDifferenceCIEDE2000($color2) . "\n");
echo('Euclidean RGB:' . $color->getDifferenceEuclideanRGB($color2) . "\n");
echo('Euclidean Lab:' . $color->getDifferenceEuclideanLab($color2) . "\n");
echo('Weighted Euclidean RGB:' . $color->getDifferenceWeightedEuclideanRGB($color2) . "\n");
new Color(new RGB(255, 183, 255), referenceWhite: ReferenceWhite::D65);
new Color(new RGB(255, 183, 255), RGBSpace: RGBSpace::sRGB_D65);
new Color(new RGB(255, 183, 255), referenceWhite: ReferenceWhite::D65, RGBSpace: RGBSpace::sRGB_D65);