Re: [css4-color] HLC <= CIE-La*b*

On Mon, Nov 21, 2011 at 12:24 PM, Lea Verou <> wrote:
> This could be rectified by using a more human-readable syntax like for
> example "80% of aliceblue".
> Color stops would then become unambiguous, although still hard to read,
> like:
>    linear-gradient(50% of black 10%, 90% of white 80%)
> However I'd argue that this is also hard to read, if not harder:
>    linear-gradient(rgba(0,0,0,.5) 10%, rgba(255,255,255,.9) 80%)

Both are difficult to read.  The second, though, can be understood
without deep knowledge of grammars (you just have to know that there's
a color and a length/percentage), while the first is somewhat harder.

I was going to mention that it also requires lookahead in the
box-shadow and text-shadow grammars, but it actually doesn't, because
percentages aren't allowed there.

Ah, here's an example where lookahead is required: the 'background'
property.  If you see the following:

background: url(foo) 5% 10% ...;

Currently, you can immediately tell that the 5% 10% is a
background-size, without caring about what the ... represents.  With
"<percentage> of <color>", though, you can't - if the next two tokens
are "of" and a color, then the background-size is just "5%", but
otherwise it's "5% 10%".  We try and avoid lookahead as much as
possible, as it makes grammars more difficult.

> As an author, I'd welcome such a change. I can't even begin to count how
> many times I had to convert a hex color or a keyword to RGB/HSL to be able
> to apply transparency to it. Not all color notations are functional to get a
> second function ending in "a".
> Obviously, such a change would also instantly solve all previous debates
> around #RRGGBBAA and #RGBA (I don't remember if consensus was reached on
> that one).

4 and 8-digit hex colors are planned for Colors 4.  I feel your pain.


Received on Monday, 21 November 2011 20:35:56 UTC