Re: [css4-color] Grayscale shorthand (with alpha)

On Tue, Apr 17, 2012 at 5:03 AM, Rudolph Gottesheim
<r.gottesheim@loot.at> wrote:
> Am 17.04.2012 13:52, schrieb Philippe Wittenbergh:
>> This idea has been discussed before, as part of this thread:
>> http://lists.w3.org/Archives/Public/www-style/2011Aug/thread.html#msg37
>
> Yeah, I saw that thread just before I wrote my mail. But as far as I can
> tell there was no talk about the *alpha* part of my proposal. Also - even
> though the Syntax looks pretty awesome - it would only support a limited
> number of shades (16), which I find pretty limiting.

There was talk of alpha, though it may have been split across months
and thus difficult to see in the archives.  I know because I argued
about it. ^_^

Quickly rehashing my arguments from that thread:

I think a hex-based version of gray is a no-go.  You either have to
limit yourself to a single digit, or use 2 digits with a different
expansion strategy from the 3-digit form.  Both possibilities are
hostile to any attempt to add alpha to the 3/6 digit form (making them
4/8 digits), as the expansion rule is, again, quite different.

Adding a gray() function that takes a <number> or <percent>, along
with an optional alpha, works a bit better.  However, it's somewhat
redundant with the fairly easy-to-use hsl() function.  Instead of
"gray(", you have "hsl(0,0%," - only a few more characters.  However,
I think it's still a reasonable win due to readability, and the
ubiquity of gray-axis colors (people often use "near-white" and
"near-black" for backgrounds and text, to lower the harshness of the
contrast of real white and black).

When we start on Colors 4, which I'll do sometime reasonably soon if
no one else gets to it, I'll make sure gray() makes an appearance.

~TJ

Received on Tuesday, 17 April 2012 17:10:27 UTC