LeaVerou / css.land

Hands on CSS demos
https://css.land
MIT License
225 stars 17 forks source link

Chroma-adjust rather than per-channel clip #3

Closed tabatkins closed 4 years ago

tabatkins commented 4 years ago

Rather than per-channel clipping for out-of-gamut colors, which can change the hue and lightness unpredictably, adjust chroma until it's on the gamut boundary.

LeaVerou commented 4 years ago

Thanks, merged!

imkremen commented 4 years ago

But now it's not LCH. Now it's like HSLuv (HSLab?)

LeaVerou commented 4 years ago

Huh? The rendering intent does not define a color space.

imkremen commented 4 years ago

It's not about color space (sRGB, P3), it's about color model. In practice, with this chroma adjustment we will get the new type of color model (just imagine color cylinder). If you look at popular color libraries you will see that all of them use clipping. I understand problem with clipping, but HSLuv from this point looks like better solution.

tabatkins commented 4 years ago

I'm sorry, but everything you've said here is wrong. Rendering intent has nothing to do with color space (which is what HSLuv is). Clipping vs chroma-adjustment vs whatever is a totally independent decision for how you handle outputting to a smaller color space.

Popular color libraries may do channel clipping (in sRGB after conversion!), but that just means they're doing bad gamut reduction because it's cheaper/simpler.

imkremen commented 4 years ago

Sorry for confusing. Yes, you are totally right.