W3C home > Mailing lists > Public > www-style@w3.org > July 2005

[CSS3 Color] Percentages in Alpha Value etc.

From: Christoph Päper <christoph.paeper@tu-clausthal.de>
Date: Fri, 08 Jul 2005 06:24:48 +0200
Message-ID: <42CE0010.9050500@tu-clausthal.de>
To: www-style@w3.org

Dear CSS WG,

I know it is pretty much too late and I have asked this before¹---for I 
am really not happy about this part of the specification at all---, but 
what is the rationale for not allowing percentage values for 'alpha'?
After all the current allowed value range of 0.0--1.0, which was for 
some reason blindly inherited from SVG and there from unquestioned 
graphic designer tradition, is just a percentage value in disguise.
Is the sole reason that this percentage value would not refer to some 
value of the parent?

Furthermore, is it really wise to not use 'deg'---a unit already
introduced in CSS 2.0, although only used with later removed aural 
properties there---in a value that is indeed an angle, namely the _h_ue 
in 'hsl()' and 'hsla()'?
At least /allow/ the unit!

Maybe the pseudo-functions for color calculation ('rgb()', 'rgba()', 
'hsl()' and 'hsla()') could be thought over once again, in a way that 
allows *any* of their parameters to be *any* of these:

  - angular:
    · degree:   'deg'  ("100%" = "360deg"),
    · gon/grad: 'grad' ("100%" = "400grad"),
    · radian:   'rad'  ("100%" ~= "6.283rad");
  - percentage ('%');
  - integer (0--255 = 2^{0}-1--2^{8}-1) and, perhaps, just for
    compatibility with implementations of the current draft
  - float (0.0--1.0).

Round-tripping (for angles) and clipping (for the rest) as usual. AFAIK 
some (CSS 2.1) imlementations are already pretty docile on mixes of 
percentages and integers in 'rgb()'.

Of course nobody is using angular "green" values (AFAIK), but the
conversion is simple and one certainly could make up a visual model, in
which a color is representated by three angular values for red, green
and blue (or hue, saturation, luminance).

There also seems to be little reason not to allow alpha values in the 
short and long hexadecimal format, they would just have to gain a digit:
#0000--#FFFF and #00000000--#FFFFFFFF. After all, from my experience, 
this is the most popular form for specifying colors out there in 
stylesheets. I will not go as far as suggesting, that something like 
"rgb(#0, #F, #0F)" (= "#00FF0F" = "rgb(0, 255, 15)") should be allowed.

Anyone could pick his preferred style out of these (keeping backwards
compatibility in mind, if desired, in the case of 'rgb()') and it is
coherent with CSS's practice of appending any number, safe zero, with a
unit (let us ignore 'line-height' for a moment, where no appropriate
unit was available). The only (probably unresolvable) problems I see is 
with pioneering implementaions, which treat any unit-less hue as a 
degree, and alpha values of '1' as '1.0' = '255' ('0' == '0.0'). That 
you get from inconsistency, you cannot extend/correct later easily.

	Christoph Päper

¹ Threads

   · [CSS21] response to issue 74

   · [css3-colors] Comments on Last Call
     with this unsatisfactory reply from Chris Lilly
     that, it seems, I have never replied to.
Received on Friday, 8 July 2005 04:24:54 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:19 UTC