Adjust OKLCH lightness to create nearby interaction states:
use PhpColor\Color\Color;
$brand = Color::parse('#3b82f6');
$hover = $brand->lighten(0.08)->toHex();
$pressed = $brand->darken(0.08)->toHex();
use PhpColor\Color\Color;
$brand = Color::parse('#3b82f6');
$hover = $brand->lighten(0.08)->toHex();
$pressed = $brand->darken(0.08)->toHex();
lighten() and darken() return new colors in the same color space as $brand. The original color remains unchanged, and the amount is applied to perceptual lightness rather than RGB channels.
These states still need contrast checks in their actual component. See Adjust lightness, chroma, and hue for exact lightness values and gamut considerations.