Build controlled color scales

Generate an exact number of ordered lightness steps from one source color with an explicit range.

oklch(0.62 0.10 260)
L 0.26
#022053
L 0.35
#18386e
L 0.44
#305289
L 0.53
#496ca5
L 0.62
#6287c2
L 0.71
#7da2e0
L 0.80
#98bffe

Each native step: L +0.09

Set the range and the number of stops

This seven-stop scale moves lightness from 0.26 to 0.80. Native chroma, hue, and alpha remain unchanged.

Control the perceptual progression

lightnessScale() creates the requested number of colors between explicit minimum and maximum lightness values.

<?php

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

$scale = ColorPalette::lightnessScale(
    Color::parse('oklch(0.62 0.10 260)'),
    steps: 7,
    min: 0.26,
    max: 0.80,
);

echo implode(', ', $scale->toHex());

// #022053, #18386e, #305289, #496ca5, #6287c2, #7da2e0, #98bffe
use PhpColor\Color\Color; use PhpColor\Color\Palette\ColorPalette; $scale = ColorPalette::lightnessScale( Color::parse('oklch(0.62 0.10 260)'), steps: 7, min: 0.26, max: 0.80, ); echo implode(', ', $scale->toHex()); // #022053, #18386e, #305289, #496ca5, #6287c2, #7da2e0, #98bffe

Change lightness and retain the other coordinates

The native OKLCH objects retain chroma 0.10, hue 260, and alpha 1. Only lightness changes.

7Requested colors
0.09Native lightness interval
0.10Retained chroma
260Retained hue

Generate a scale, then evaluate its use

A generated lightness progression is ordered and predictable. It is not automatically a complete interface token system.

Hex serialization quantizes native OKLCH values.

The method does not repair an existing scale or evaluate contrast.

Extreme lightness and chroma combinations can clip when converted to sRGB.

Choose a next step

Generate a scale for your token system