web-platform-tests / wpt

Test suites for Web platform specs — including WHATWG, W3C, and others
https://web-platform-tests.org/
Other
4.89k stars 3.06k forks source link

Color serialization with channel keywords and calc #47921

Open tiaanl opened 1 week ago

tiaanl commented 1 week ago

When specifying a channel keyword in a color there are two methods:

rgb(from red r g b) and rgb(from red calc(r) calc(g) calc(b))

According to css/css-color-parsing/color-valid-relative-color.html they serialize exactly as specified, so specifying a channel keyword without calc serializes without calc and specifying with calc serializes with calc.

When a calc contains a single numerical value, the calc() part can be omitted, otherwise it should be serialized with it as per https://drafts.csswg.org/css-values-4/#calc-serialize.

Should these rules apply to channel keywords as well and how would it change the examples I gave?

nt1m commented 1 week ago

@weinig