- From: Chris Lilley via GitHub <sysbot+gh@w3.org>
- Date: Wed, 10 Jul 2024 11:56:55 +0000
- To: public-css-archive@w3.org
CSS Color 4 has a concept of [legacy color syntax](https://csswg.sesse.net/css-color-4/#legacy-color-syntax). Essentially, pre-css color 4 colors (rgb, rgba, hsl, hsla) get serialized as they always have. Non-legacy colors are serialized as described in csswg.sesse.net/css-color-4. The simplest solution would just be to do exactly what CSS is doing, while preserving "opaque colors are hex" quirk from https://html.spec.whatwg.org/#serialisation-of-a-color. ``` ctx.fillStyle = "rgb(255, 0, 255)"; ctx.fillStyle; // '#ff00ff' ctx.fillStyle = "rgb(255, 0, 255, 0.5)" ctx.fillStyle; // 'rgb(255, 0, 255, 0.5)' ctx.fillStyle = "color(dIsPlAy-P3 0.964 0.763 0.787)" ctx.fillStyle; // 'color(display-p3 0.96 0.76 0.79)' ``` Could we even link to https://csswg.sesse.net/css-color-4/#serializing-color-function-values? We obviously need some tests in wpt to cover this. _Originally posted by @mysteryDate in https://github.com/whatwg/html/issues/8917#issuecomment-1545818463_ -- GitHub Notification of comment by svgeesus Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10550#issuecomment-2220323467 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 10 July 2024 11:56:55 UTC