ContrastFixer

Fixes contrast issues in palettes for accessibility.

Ensures colors meet WCAG contrast requirements against a background color
by adjusting lightness. preserve_hue and preserve_chroma default to true
(lightness only); set either to false to let that dimension relax when a
fixed-lightness-only search cannot reach the target within max_iterations.

Methods

public function analyze(ColorPaletteInterface $palette): array
Parameters
NameTypeDefault
$palette ColorPaletteInterface -

fix

public function fix(ColorPaletteInterface $palette, array $options): ColorPaletteInterface
Parameters
NameTypeDefault
$palette ColorPaletteInterface -
$options array []