W3C home > Mailing lists > Public > public-css-archive@w3.org > November 2016

[csswg-drafts] [css-color-4][css-color-3] Computed value of the color property

From: Florian Rivoal via GitHub <sysbot+gh@w3.org>
Date: Mon, 21 Nov 2016 01:35:16 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-190600073-1479692115-sysbot+gh@w3.org>
frivoal has just created a new issue for 

== [css-color-4][css-color-3] Computed value of the color property ==
[The css-color-4 definition of the computed value of the color 
property](https://drafts.csswg.org/css-color/#propdef-color) says :

> Computed value:       an RGBA color

That doesn't sound right:

* This is not entirely clear what is meant by that. The simplest 
interpretation is that the value should be computed to the `rgba()` 
function, but maybe something else is intended.
* If computing to `rgba()` is intended, this appears to contradicts 
[css-color-3](https://drafts.csswg.org/css-color-3/#color0). The rule 
there is phrased in a somewhat ambiguous way, but seems to imply that 
basic colors, hex colors, and `rgb()` colors should be computed to the
 six digit hex value or `rgb()` functional value, while other 
notations should be preserved as specified.
* Browsers today (checked Chrome, Firefox, Safari, Edge, Presto) 
interoperably return `rgb()` (not `rgba()`) as the computed value of 
hex colors or named colors when exposing it through getComputedStyle. 
In contradiction of css-color-3, All also do so for `hsl()` colors. 
And but all but Edge also for `rgba()` and `hsla()` colors with an 
alpha of 1 (Edge compute both to `rgba()`).
* How to convert `color()` colors to `rgba()` is non trivial and 
lossy. It needs to happen eventually to be able to paint, but computed
 value time seems wrong.

If the level 4 text is meant to be different from the level 3, we 
should errata level 3, and be clearer about what exactly is meant. But
 given the compat data and the newer color functions, neither "always 
`rgba()`" nor “as specified, except but #rrggbb `rgb()` and named 
colors” seems to be the right answer. I think we should specify what 
is already inter-operable (and see if Edge is willing to join everyone
 else on computing `rgba(*,*,*,1)` and `hsla(*,*,*,1)` to `rgb()`.

The new color functions that do not yet have a compat baggage, so we 
should probably be clear before they get one. We could keep them as 
specified, or maybe convert them to a base notation: `gray()`and 
`lch()` -> `lab()`, `hwb()` and `hwb()`-> `color()`, omit the alpha 
component when it is 1.

As for the comma-less version of rgb() and hsl(), we also should 
decide if the compute to the legacy syntax (with commas), preseve them
 as written, or compute to `color()`...

Please view or discuss this issue at 
https://github.com/w3c/csswg-drafts/issues/742 using your GitHub 
Received on Monday, 21 November 2016 01:35:23 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:05 UTC