Generate a triadic color palette

Derive three colors spaced evenly around the hue wheel from one source color.

Use the triadic() harmony when a palette needs three evenly spaced hues:

use PhpColor\Color\Color;
use PhpColor\Color\Palette\ColorPalette;

$brand = Color::parse('#3b82f6');
$palette = ColorPalette::scale($brand->triadic());

foreach ($palette->toHex() as $hex) {
    echo $hex.PHP_EOL;
}
use PhpColor\Color\Color; use PhpColor\Color\Palette\ColorPalette; $brand = Color::parse('#3b82f6'); $palette = ColorPalette::scale($brand->triadic()); foreach ($palette->toHex() as $hex) { echo $hex.PHP_EOL; }

The scale contains the source color followed by colors rotated by 120 and 240 degrees in OKLCH. The returned colors keep the source color space.

A geometric harmony does not guarantee equal prominence, contrast, or in-gamut output. See Build color harmonies for the other available harmony names.