Re: [csswg-drafts] [css-color-4] HWB normalization under-specified? (#9228)

> Hm, I suppose the "after normalization" doesn't actually reference anything, yeah. There should be a more explicit statement about normalizing the white and black %s to sum to 100% if they sum to >100%.

The term was removed but the statement is linkable. We now have

```html
<p id="hwb-normalization">If the sum white+black is greater than or equal to <span class="css">100%</span>,
 it defines an achromatic color,
 i.e. a shade of gray;
 when converted to sRGB the R, G and B values are identical
 and have the value white / (white + black).</p>
```

This does still mean that out-of-sRGB-gamut colors do not round-trip through HWB because they are incorrectly seen as achromatic ([live test](https://codepen.io/svgeesus/pen/xxmGLjY?editors=0011)):

```js
// an oog, rec2020 color converted to sRGB
let tmp = (rgbToHsl(0.8892417662560173, -0.007998964113115263, 0.562048294772405));
console.log("hsl = ", tmp);
console.log("rgb from hsl = ", hslToRgb(tmp[0], tmp[1], tmp[2]));

let tmp2 = (rgbToHwb(0.8892417662560173, -0.007998964113115263, 0.562048294772405));
console.log("hwb = ", tmp2);
console.log("rgb from hwb = ", hwbToRgb(tmp[0], tmp[1], tmp[2]));
```

"hsl = " // [object Array] (3)
[321.87997894493725, 101.81538256963105, 44.0621401071451]

"rgb from hsl = " // [object Array] (3)
[0.8892417662560173, -0.007998964113115237, 0.5620482947724053]

"hwb = " // [object Array] (3)
[321.87997894493725, -0.7998964113115262, 11.075823374398276]

"rgb from hwb = " // [object Array] (3)
[0.6979511353179851, 0.6979511353179851, 0.6979511353179851]

Because -0.7998964113115262 + 11.075823374398276 >= 1


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


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

Received on Wednesday, 20 September 2023 14:29:15 UTC