Build color shades

Turn one color into a complete, ordered collection of mixes toward black.

0
#806eae
0.25
#554975
0.5
#2e2641
0.75
#0b0813
1
#000000
SourceOklab mixes toward blackBlack

Include both ends of the shade sequence

With more than one step, the collection starts with the source and ends at black. Every intermediate color is an evenly spaced Oklab mix.

Generate every shade together

Choose the source and number of steps. PHPColor returns an ordered palette while leaving the source color unchanged.

<?php

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

$source = Color::parse('#806eae');
$shades = ColorPalette::shades($source, 5);

print_r($shades->toHex());
// #806eae #554975 #2e2641 #0b0813 #000000
use PhpColor\Color\Color; use PhpColor\Color\Palette\ColorPalette; $source = Color::parse('#806eae'); $shades = ColorPalette::shades($source, 5); print_r($shades->toHex()); // #806eae #554975 #2e2641 #0b0813 #000000

Shading is not lightness adjustment

shade() mixes the complete color toward black in Oklab. darken() changes only the OKLCH lightness coordinate. A shade collection is also not a dark-mode palette.

At least one step

One step returns only the source. With more than one, ratios run evenly from zero through one and include black.

No theme guarantee

Shades do not guarantee foreground contrast, assign token roles, or derive an accessible dark theme. A translucent source also mixes its alpha toward opaque black.

Continue the sequence

Compare Oklab shades with their matching tints