Re: [csswg-drafts] [cssom-1][css-color-4] Move serialization of `<color>` and `<alpha-value>` (#9798)

> To be honest, I cannot say I understand all the intricacies of this algorithm and the relation with unsigned 8-bit representation, but `0.498` is the result in Chrome and Firefox.

I [came across this](https://github.com/chromium/chromium/commit/5deed17c9f1446cf0a061d7566e552e8e9bddfaf#diff-1bb6772ac74c6531ba9dd6432fcf301a1d29df66c36bc606e4ab924943ade602R1016) in Chrome:

```
    // Legacy color channels get serialized with integers in the range [0,255].
    // Channels that have a value of exactly 0.5 can get incorrectly rounded
    // down to 127 when being converted to an integer. Add a small epsilon to
    // avoid this. See crbug.com/1425856.
    std::tie(r, g, b) =
        gfx::SRGBToSRGBLegacy(r + kEpsilon, g + kEpsilon, b + kEpsilon);
```


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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 20 February 2024 21:20:48 UTC