W3C home > Mailing lists > Public > public-css-archive@w3.org > October 2020

Re: [csswg-drafts] [css-color-4] Clamping of color values (#3845)

From: Chris Lilley via GitHub <sysbot+gh@w3.org>
Date: Wed, 21 Oct 2020 17:39:30 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-713741000-1603301969-sysbot+gh@w3.org>
> reducing C in an out-of-gamut LCH color is not always amenable to the bisection method, due to the weird shape around yellows

Yes, when doing gamut mapping from display-p3 to sRGB (or rec2020 to display-p3) I also found problems due to gamut surface concavities around yellow (and cyan). The solution was, at each iteration of the bisection method, to calculate the deltaE between the current iteration and a channel-clamped copy of current iteration (which by definition will be in gamut). If the deltaE is less than some threshold (so the two values are not easily distinguishable), terminate bisection and return the clamped value.

This is better explained, and with diagrams, on the [color.js gamut mapping page](https://colorjs.io/docs/gamut-mapping.html). In that code, deltaE2000 is used with a threshold of 2. It made a huge difference and eliminated the spurious, ultra-low-Chroma results we were seeing with the more straightforward methods.

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 21 October 2020 17:39:32 UTC

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