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: Fri, 09 Sep 2011 19:46:26 +0400
To: Patrick Garies <pgaries@fastmail.us>
Cc: Tab Atkins Jr. <jackalmage@gmail.com>,www-style@w3.org
Message-Id: <496041315583186@web142.yandex.ru>
> Unfortunately, CSS is locked into the confusing |#RRGGBBAA| syntax since
> backward-compatibility with programs that already support this syntax
> was part of the rationale for its inclusion.

What exact programs you are talking about? For example, in Photoshop, opacity and nontransparent hex color are separate properties that needs to be copied separately anyway.

> Adding a full stop (i.e., ".") character as a separator within the
> syntax would break that compatibility.

It's unclear what compatibility you are talking about, but just in case: point in my proposed syntax is decimal point of full fractional number (from 0.0 to 1.0). Integer part of number is just removed since it's needed only for exactly one opacity value: 1.0. But for 100% opacity we don't need for opacity component at all. So we can safely remove integer part and elegantly use decimal point itself as a compact hex/alpha separator.



07.09.2011, 07:06, "Patrick Garies" <pgaries@fastmail.us>:
> On 9/6/2011 2:26 PM, Marat Tanalin wrote:
>
>> š2. As for alpha opacity. The only reason why RGB components can be
>> šrepresented as hex is that each RGB component has exactly 256
>> špossible values _by nature_. But this has NOTHING TO DO with opacity.
>> šOpacity is always specified as decimal number: for example in
>> š"opacity" CSS-property, opacity in "rgba()" CSS-function, or
>> špercentage transparency in Photoshop. So, hex representation is not
>> šonly nonapplicable to opacity values, but just inconsistent with
>> šexisting opacity values notation. Therefore, opacity should be kept
>> šspecified as a decimal number and is not a subject to shorten at
>> šall.
>>
>> šExact possible syntax for adding alpha-opacity to hex colors is
>> šfollowing:
>>
>> š#cad8d9.0 šš-- zero opacity; #cad8d9.27 š-- 27% opacity; #cad8d9.275
>> šš-- 27.5% opacity; #cad8d9 šššš-- 100% opacity (no need for opacity
>> šcomponent at all, using just regular hex value.).
>
> Unfortunately, CSS is locked into the confusing |#RRGGBBAA| syntax since
> backward-compatibility with programs that already support this syntax
> was part of the rationale for its inclusion. I believe the idea is that
> you'll be able to copy and paste such values directly into a style sheet.
>
> Adding a full stop (i.e., ".") character as a separator within the
> syntax would break that compatibility.
Received on Friday, 9 September 2011 15:47:00 GMT

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