PHPColor 1.1 is out. It adds a few focused tools, but most of the release is a correctness pass across color science, palettes, gradients, alpha handling, and CSS output.
Repair uneven color scales
The new ScaleFixer analyzes the OKLCH lightness progression of an ordered
palette and can redistribute it evenly between the endpoints. It retains entry
order and palette keys, with options to preserve each color's hue, chroma, and
alpha. It complements the existing ways to generate color
scales when a scale
already exists but its steps have drifted.
Every color now has a direct toOklch() method. ColorPaletteInterface::closest()
also accepts an optional color-distance metric, so nearest-token matching can use
the algorithm required by a workflow instead of the default Oklab distance. The
color distance guide covers the
available algorithms and why their values are not interchangeable.
Relative color syntax now supports hwb and srgb-linear targets as well. See
relative colors for the concrete and
deferred forms.
More fixes than features
APCA calculations now follow the canonical 0.0.98G algorithm. The Delta E 94 hue term is corrected, and Lab and LCH conversions use the D50 reference white. Gamut mapping is checked again after channel quantization.
The output path received a similar pass. HWB conversions and CSS variables keep alpha values. CSS variables retain non-sRGB notation. Gradient serialization produces valid CSS and keeps explicit stop positions, while interpolation now handles premultiplied alpha and encoded sRGB channels correctly. Palette filtering and slicing also preserve the palette type and reindex scale keys.
CSS output now uses six significant digits. The renamed
SrgbColor::getHslChannels() method replaces toHsl(), which remains available
as a deprecated alias.
See the 1.1.0 release and full changelog for the complete list.