W3C home > Mailing lists > Public > public-css-archive@w3.org > January 2021

Re: [csswg-drafts] [css-images-4] Consider allowing gradients to include a color space for interpolation to take place in (#5833)

From: Chris Lilley via GitHub <sysbot+gh@w3.org>
Date: Tue, 05 Jan 2021 10:16:14 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-754543860-1609841773-sysbot+gh@w3.org>
And yes, both Lab and LCH are useful here. Both are (approximately) perceptually uniform; LCH is also chroma-preserving so a gradient between two very different, saturated hues will go around the hue circle rather than in a straight line, which will get greyish near the middle.

Both options avoid the un-necessary darkening that happens when calculations are done directly on the gamma-encoded RGB values rather than converting them to linear-light first.

CSS Color 5 has [a section on color interpolation](https://drafts.csswg.org/css-color-5/#interpolation) which can be used as a basis (and allows an individual CSS feature to pick a default colorspace for a given operation, as well as encouraging ssntax so authors can pick other colorspaces). In particular it defines [interpolating with alpha](https://drafts.csswg.org/css-color-5/#interpolation-alpha), and [hue interpolation[(https://drafts.csswg.org/css-color-5/#hue-interpolation) for polar spaces with a hue angle. And unlike the legacy parts of CSS, CSS Color 5 does not make assumptions like "all colors are sRGB".

As a first step, in the new year I want to make some examples with pairs of colors interpolated in various spaces, so people can see the practical effect of doing so.

GitHub Notification of comment by svgeesus
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5833#issuecomment-754543860 using your GitHub account

Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 5 January 2021 10:16:16 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:42:25 UTC