W3C home > Mailing lists > Public > www-style@w3.org > September 2011

Re: [css] Proposal: making Shorthand Hex Colors even shorter (16 grayscale shades)

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 6 Sep 2011 08:31:09 -0700
Message-ID: <CAAWBYDD1x6YRLQofhwtrbovagFMwEj0RXh1Yt7WoubhgvGhVJw@mail.gmail.com>
To: Marat Tanalin <mtanalin@yandex.ru>
Cc: www-style@w3.org
2011/9/5 Marat Tanalin <mtanalin@yandex.ru>:
> 06.09.2011, 03:03, "Tab Atkins Jr." <jackalmage@gmail.com>:
>> After more thought on the matter of 1- or 2-digit hex shorthands,
>> though, I've now come down against it.  I gave my reasoning against
>> 2-digit grays previously in the thread (the expansion rule is
>> different than for 3-digit color).
>
> Even if expansion rule is different, it does not mean this is something bad.

The difference in expansion rules is definitely bad.  This doesn't
*necessarily* mean the feature is bad, but it is a strike against it.
Consistency is important in a language.


>> As for 1-digit grays, I no longer think they're a good idea.  When
>> Colors 4 gets written I'll be pushing for (or writing, if I end up the
>> editor) 4- and 8-digit hex colors so you can specify alpha without
>> having to switch to rgba() and convert your components to decimal.  I
>> don't think it's good to add a new hex variant that can't similarly
>> receive an alpha.  (Obviously, having #0 expand into #00000000 isn't
>> useful.  Adding a second digit, like having #0c expand into #000000cc,
>> is just confusing.)
>
> rgba values (including its probable hex syntax) is a topic for another thread (if someone needs it at all) and is quite alien thing in this thread, in my opinion. Let's try to isolate regular hex-values discussion here.

We're talking about colors.  Colors should be consistent.  It is
completely relevant to discuss existing color syntaxes and
already-planned extensions of them when considering a further
extension.


>> The benefit of 1-digit grays is extremely minimal.  You get to hit a
>> key once instead of three times.  It's the same key all three times,
>> too, so the burden of hitting it thrice is basically nil.
>
> It's not about key-hitting. #ccc just _redundant_ compared with #c. So, if we able to shorten #cccccc to #ccc, then shortening #ccc to #c (as well as #acacac to #ac) seem just logical. Anyway, we would _lose nothing_ if this feature would be added.

Redundancy isn't necessarily bad - sometimes it can make things easier
to understand.  Even when it is bad, one still has to consider the
*amount* of bad that it is, and judge whether it's worth fixing, and
whether the solution chosen is worth the cost.

I don't think the redundancy of tripling a single character is very
significant, and the cost of augmenting a compact shorthand notation
is relatively high (higher than other things with googleable names).


>> I am still okay with a gray() function, though, which takes a single
>> number/percentage, and then optionally an alpha value.  I'm not sure
>> if we *need* it, but I'm favorably disposed to it.
>
> The topic is not about some new functions, it's about shortening existing hex values.

Again, the topic is about colors, specifically about making it easier
to represent grays.  A gray() function is another option to consider.

~TJ
Received on Tuesday, 6 September 2011 15:31:57 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:44 GMT