Everything so far handled one color at a time. The composition APIs take one color in and hand structured sets back -- and since they all speak ColorInterface, anything from the previous steps feeds straight in.
Palettes and scales
ColorPalette expands a base into tonal ramps:
use PhpColor\Color\Color;
use PhpColor\Color\Palette\ColorPalette;
$blue = Color::parse('#3b82f6');
ColorPalette::tints($blue, 5); // toward white
ColorPalette::shades($blue, 5); // toward black
use PhpColor\Color\Color;
use PhpColor\Color\Palette\ColorPalette;
$blue = Color::parse('#3b82f6');
ColorPalette::tints($blue, 5); // toward white
ColorPalette::shades($blue, 5); // toward black
Harmonies
The classic wheel relationships, one call each, straight on the color object:
$blue->complementary(); // #c17400
$blue->triadic(); // [$blue, #e24956, #3ba01b]
$blue->analogous(); // [$blue, #886cee, #0097e1]
$blue->complementary(); // #c17400
$blue->triadic(); // [$blue, #e24956, #3ba01b]
$blue->analogous(); // [$blue, #886cee, #0097e1]
Gradients
Gradient interpolates in OKLab, so midpoints stay vivid instead of dipping through gray. It emits CSS directly, or hands you any point on the ramp:
use PhpColor\Color\Gradient\Gradient;
$g = Gradient::linear(90, '#3b82f6', '#f43f5e');
$g->toCss();
// linear-gradient(90deg, rgb(59 130 246) 0%, rgb(244 63 94) 100%)
$g->interpolate(0.5)->toHex();
// #aa73ae
use PhpColor\Color\Gradient\Gradient;
$g = Gradient::linear(90, '#3b82f6', '#f43f5e');
$g->toCss();
// linear-gradient(90deg, rgb(59 130 246) 0%, rgb(244 63 94) 100%)
$g->interpolate(0.5)->toHex();
// #aa73ae
Go deeper: Palettes, harmonies, and gradients covers the builders, palette fixers, and CSS export.