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

Re: [csswg-drafts] [css-color-4] Some example HWB-to-RGB translations are incorrect (#5531)

From: Natalie Weizenbaum via GitHub <sysbot+gh@w3.org>
Date: Fri, 18 Sep 2020 21:19:12 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-695091295-1600463951-sysbot+gh@w3.org>
It looks like floating-point errors aren't limited to grayscale cases. `hwb(30, 0%, 80%)` is listed as `#331900` because

```
hwbToRgb(30/60, 0, 0.8).map(c => c * 255)
= [50.999999999999986, 25.499999999999993, 0]
_.map(Math.round) = [51, 25, 0]
```

But mathematically it should be `[51, 25.5,0]` which rounds to `[51, 26, 0]`. This is harder to fix in the example function because each step of the arithmetic is unavoidable, but I think it probably still makes sense to use mathematically correct example colors.

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Friday, 18 September 2020 21:19:14 UTC

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