Adapt color white points
Move color coordinates between viewing references with an explicit chromatic-adaptation method.
D50 source0.7 0.35 0.2 / 0.8Bradford to D650.678287 0.348911 0.234581 / 0.8CAT16 to D650.686249 0.357012 0.237624 / 0.8The reference changes while type and alpha remain
Both methods adapt the D50 source to D65 through XYZ. The returned values remain ProPhotoColor objects with alpha 0.8.
Name both white points and the method
The adaptation API does not infer source or destination viewing conditions. Supply both normalized white points and select Bradford or CAT16 explicitly.
<?php
use PhpColor\Color\Color;
use PhpColor\Color\Colorimetry\Adaptation\Adapt;
use PhpColor\Color\Colorimetry\Illuminant;
$source = Color::parse(
'color(prophoto-rgb 0.7 0.35 0.2 / 0.8)',
);
$adapted = Adapt::color(
$source,
Illuminant::D50->whitePoint(),
Illuminant::D65->whitePoint(),
'bradford',
);
echo $adapted->toCss();
// color(prophoto-rgb 0.678287 0.348911 0.234581 / 0.8)
use PhpColor\Color\Color;
use PhpColor\Color\Colorimetry\Adaptation\Adapt;
use PhpColor\Color\Colorimetry\Illuminant;
$source = Color::parse(
'color(prophoto-rgb 0.7 0.35 0.2 / 0.8)',
);
$adapted = Adapt::color(
$source,
Illuminant::D50->whitePoint(),
Illuminant::D65->whitePoint(),
'bradford',
);
echo $adapted->toCss();
// color(prophoto-rgb 0.678287 0.348911 0.234581 / 0.8)
Adaptation needs colorimetric context
The API accepts any source and destination white points you provide. It does not inspect an ICC profile, viewing environment, device, or file metadata to determine whether adaptation is appropriate.
SourceAn explicit reference white.
DestinationAn explicit reference white.
MethodBradford or CAT16.
PreservedConcrete type and alpha channel.