darken(0.15)
#56437f
Make colors lighter or darker
Derive lighter and darker variants by changing OKLCH lightness while leaving the source color unchanged.
#806eae
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.
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.