1. Go to this page and download the library: Download domm98cz/color 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/ */
domm98cz / color example snippets
use Domm98CZ\Color\Fluent\HexColor;
use Domm98CZ\Color\Fluent\RgbColor;
$brand = new HexColor('#3366cc');
$brand->lighten(0.1)->toHex(); // "#5085ee" (OKLCh lightness +0.1)
$brand->complement()->toHex(); // "#916300" (opposite hue on the OKLCh wheel)
$brand->mix(new RgbColor(255, 204, 0), 0.25)->toHex(); // "#6686b6" (25 % gold, mixed in OKLab)
$brand->shades(5); // #264ea0 #193875 #0d234e #040f29 #010209
$brand->contrastWith(new HexColor('#fff'))->value; // 5.366401794534009
use Domm98CZ\Color\Color;
use Domm98CZ\Color\Space\ColorSpaces;
use Domm98CZ\Color\Space\Record\Oklch;
$blue = Color::fromHex('#3366cc');
$blue->in(Oklch::class)->h; // 262.2930486125381, null for achromatic colors
$blue->to(ColorSpaces::displayP3()); // Display P3 coordinates 0.2499 0.3952 0.7736 (rounded)
Color::parse('color(display-p3 1 0 0)')->toHex(); // OutOfGamutException