Make colors lighter or darker

Derive lighter and darker variants by changing OKLCH lightness while leaving the source color unchanged.

Darker L 0.431 darken(0.15)
#56437f
Source L 0.581 #806eae
Lighter L 0.731 lighten(0.15)
#ad9bdf

L -0.15OKLCH lightnessL +0.15

Move one perceptual coordinate

Lightness moves by -0.15 or +0.15. Native chroma, hue, and alpha remain fixed before the result converts back to SrgbColor.

Derive both variants from one source

lighten() adds to OKLCH lightness. darken() applies the same operation with a negative amount. Both return new objects in the receiver's concrete class.

<?php

use PhpColor\Color\Color;

$source = Color::parse('#806eae');
$darker = $source->darken(0.15);
$lighter = $source->lighten(0.15);

echo $darker->toHex();  // #56437f
echo $source->toHex();  // #806eae
echo $lighter->toHex(); // #ad9bdf
use PhpColor\Color\Color; $source = Color::parse('#806eae'); $darker = $source->darken(0.15); $lighter = $source->lighten(0.15); echo $darker->toHex(); // #56437f echo $source->toHex(); // #806eae echo $lighter->toHex(); // #ad9bdf

Lightness is not tinting

Changing OKLCH lightness is not the same as mixing toward white or black. Use tints or shades when those endpoints define the result.

LightenAdd to OKLCH lightness.
DarkenSubtract from OKLCH lightness.
TintMix toward white in Oklab.
ShadeMix toward black in Oklab.

Check the serialized result in context

Lightness clamps to 0..1. Hexadecimal output quantizes native channels, and extreme values can leave the target RGB gamut before serialization.

The methods make relative changes. Assign the OKLCH channel directly when an exact target lightness is required.

A lighter or darker color does not guarantee component contrast.

Choose a next step

Derive a state, then check it in context