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

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

From: Marat Tanalin <mtanalin@yandex.ru>
Date: Tue, 06 Sep 2011 03:32:33 +0400
To: Tab Atkins Jr. <jackalmage@gmail.com>
Cc: www-style@w3.org
Message-Id: <1077441315265553@web104.yandex.ru>
06.09.2011, 03:03, "Tab Atkins Jr." <jackalmage@gmail.com>:
> 2011/9/5 Marat Tanalin <mtanalin@yandex.ru>:
>>> ššAs for similar additions to rgba (that has been mentioned in the thread), I personally almost don't care about this since I consider rgba paradigm itself just wrong and almost useless as for CSS:
>>>
>>> ššinstead of rgba(), it would be _much_ more useful to have background-opacity property that would control opacity of _entire_ background including background color _and_ image together. Those interested may see proposal in sibling thread I've started a moment ago:
>>>
>>> ššhttp://lists.w3.org/Archives/Public/www-style/2011Sep/0033.html
>
> I don't understand how you think rgba() is wrong and how it can be
> replaced by 'background-opacity'. šColors are used in far more than
> just 'background-color'. šPartially-transparent border or text colors
> are useful, and specifying them with an alpha color is simple (better
> than adding 'border-color-opacity' and 'color-opacity' properties, for
> certain). šAlpha colors are also very useful as color-stops in
> gradients, where there is absolutely no way to replace them with a
> property.

Just most often rgba is used for background in practice. You are right that it might be used with border-color or color (though, e.g., semi-transparent text color is used far rarely).

> 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.

> 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.

> 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.

> 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.

> ~TJ
Received on Monday, 5 September 2011 23:33:10 GMT

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