Re: [csswg-drafts] [css-color-4][css-values-4] Allow use of 0 with <percentage> color components (#7338)

This is due to the historical use of 0..255 integers in `rgb()`. When we wanted to add a bit-depth-independent way to specify the RGB components, we leant on percentages. But we required you to use all one or all the other. So nothing like

`rgb(17.5% 127 54.8%)` for example.

I agree that this collides with the user expectation that 0% and 0 mean the same thing.

At this point these are both legacy syntactic forms.

Even in CSS Color 5, relative color syntax [does allow you to mix numbers and percents](https://drafts.csswg.org/css-color-5/#relative-RGB) but only with the relative color syntax; the historical forms we left untouched.

I guess the questions to ask are:

- is it worth fixing this for 0 and 0% particularly?
- is it worth fixing this for mixed numbers and percents generally
- if so, how does this affect the computed value and serialization?

I suspect that lots of in-the-wild script to manipulate color is likely to break if number and percent can be freely mixed.

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


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

Received on Sunday, 5 June 2022 23:21:56 UTC