Transform a complete palette
Apply one color operation across every entry without detaching application names.
Source
primary
secondary
accent
Shifted
primary
secondary
accent
24 degree OKLCH hue rotation
3 names retained
3 source values unchanged
Move every hue and keep every name
The complete palette rotates by 24 degrees in OKLCH. Primary, secondary, and accent remain aligned in their original order.
Apply the same immutable operation everywhere
Palette transformation methods map the corresponding color operation across the collection and return a new palette.
<?php
use PhpColor\Color\Palette\ColorPalette;
$source = ColorPalette::parse([
'primary' => '#7c3aed',
'secondary' => '#0ea5e9',
'accent' => '#f59e0b',
]);
$shifted = $source->rotateHue(24.0);
foreach ($shifted->toHex() as $name => $hex) {
printf("%s %s\n", $name, $hex);
}
// primary #a51dca
// secondary #6498f4
// accent #d6b000
use PhpColor\Color\Palette\ColorPalette;
$source = ColorPalette::parse([
'primary' => '#7c3aed',
'secondary' => '#0ea5e9',
'accent' => '#f59e0b',
]);
$shifted = $source->rotateHue(24.0);
foreach ($shifted->toHex() as $name => $hex) {
printf("%s %s\n", $name, $hex);
}
// primary #a51dca
// secondary #6498f4
// accent #d6b000
One operation does not create a semantic theme
A uniform transformation preserves collection structure, but it does not infer roles, repair contrast, or guarantee target-gamut output.
NamesString keys remain attached to transformed colors.
OrderPalette order remains unchanged.
SourceThe original palette and color objects remain unchanged.
ContextEvaluate the transformed values in their actual roles and backgrounds.