Choose a color space
Compare the coordinate systems PHPColor supports and select the right one for the operation.
Explore Spaces
sRGB
OKLCH
Display P3
CIE Lab
Rec. 2020
Move between color models without losing track of channels, gamut, or intent.
Compare the coordinate systems PHPColor supports and select the right one for the operation.
Explore SpacesTranslate colors across perceptual, display, print, and connection spaces through one API.
Explore Conversion<?php
use PhpColor\Color\Color;
$color = Color::parse('#3b82f6');
$oklch = $color->to('oklch');
$p3 = $color->to('display-p3');
use PhpColor\Color\Color;
$color = Color::parse('#3b82f6');
$oklch = $color->to('oklch');
$p3 = $color->to('display-p3');
Choose a working space and expose its channel names, values, and alpha as typed numeric data.
Explore ChannelsRead the WCAG relative luminance of any supported color through its linearized sRGB channels.
Explore LuminanceTest a color against an RGB gamut and measure channel overflow before choosing an output policy.
Explore Gamut<?php
use PhpColor\Color\Color;
use PhpColor\Color\Colorimetry\Gamut;
$color = Color::parse('color(display-p3 1 0.2 0.1)');
$fits = Gamut::isInGamut(
$color,
'srgb',
);
use PhpColor\Color\Color;
use PhpColor\Color\Colorimetry\Gamut;
$color = Color::parse('color(display-p3 1 0.2 0.1)');
$fits = Gamut::isInGamut(
$color,
'srgb',
);
Adapt a color between reference whites with Bradford or CAT16 while preserving its type and alpha.
Explore White points