Skip to content

Support for OKLab/OKLch color spaces and a new picker

Rafał Siejakowski requested to merge S-Rafael/inkscape:oklab into master

This MR adds support for the OKLab and OKLch color spaces which have just been adopted into the CSS Color Module Level 4 draft recommendation. OKLab is described in detail by its creator in an interesting blog post. The new picker is called "OKHSL" and is available from the dropdown.

okhsl

On the backend side, the MR adds a collection of functions for converting to and from OKLab and OKLch spaces. It also adds conversions to and from a space called "OKHSL" which is not standardized and is used by Inkscape only internally, for displaying the new color picker. The definition of OKHSL and consequently the appearance of the picker could be tweaked in the future (perhaps they will become a standard one day).

On the user-facing side, I've kept the new picker quite minimalistic, with typical sliders and a simple color wheel. The wheel shows colors with the same perceptual lightness, so its appearance changes when the LOK slider is moved.

Making all of this work reasonably well required some light refactoring of ColorScales, mainly replacing float variables with doubles. This was needed to achieve a reasonable precision of color conversions (the OKLab space is a non-linear reparametrization of the linear RGB).

To do list:

  • Create an icon for the OKHSL entry in the dropdown for choosing the type of color picker (looking for help!)

Closes inbox#7733 (closed)

Edited by Rafał Siejakowski

Merge request reports