W3C home > Mailing lists > Public > www-style@w3.org > January 2012

Re: [css4-color] 4 Parameters in RGB() and HSL()

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 25 Jan 2012 11:12:01 -0800
Message-ID: <CAAWBYDDEu0=_t_j7RTUxSWarMoF3seW9ek4oTZc7=WH9HG1qOQ@mail.gmail.com>
To: Christoph Päper <christoph.paeper@crissov.de>
Cc: www-style@w3.org
2012/1/25 Christoph Päper <christoph.paeper@crissov.de>:
> Several pseudo functions accept different numbers of parameters, the rightmost parameters are then optional, original ones don’t change their meaning. In CSS3: Color rgba() and hsla() have been added without taking advantage of this polymorphous capability. They also have been criticized for always denoting the alpha value as a number in the range 0.0–1.0, not as a percentage.
> Could we therefore make
>  rgb(100%, 80%, 60%, 40%)
>  hsl(300deg, 60%, 40%, 20%)
>  rgb(255, 0, 64, 127)
> valid in Level 4?

I agree that rgba/hsla were mistakes and should have been done as you
suggest, but I'm not sure it's worthwhile changing rgb/hsl at this
point (or making rgba/hsla's fourth argument optional).  I plan to
work on Colors 4 later this year, though, so I'll keep it in mind.

I'm definitely in favor of making the alpha value take a percentage as
well as a number.  It's in my list of things to change when I start
editing the spec.  (Along with allowing the first argument of hsl to
be an <angle>.)

Your third example - rgb(255, 0, 64, 127) - will always be invalid,
though - CSS can't distinguish between <integer> and <number> in
general, so the fact that alpha already takes a number in [0,1] means
we can't also have it take an integer in [0,255], because a value of 1
would be ambiguous and have *substantially* different effects based on

Received on Wednesday, 25 January 2012 19:12:56 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:10 UTC