W3C home > Mailing lists > Public > www-style@w3.org > May 2013

[css-color] Have you considered standardizing a rgba(#RRGGBB, <alpha-value>) notation?

From: Šime Vidas <sime.vidas@gmail.com>
Date: Tue, 7 May 2013 15:34:32 +0200
Message-ID: <CAF=ZmuwjoY92bfNi5veZz6CEf-yJX5bp9tt2Tm_dgS2PXe-MZg@mail.gmail.com>
To: www-style@w3.org
Example:

A developer would like to define a color which “base” is #07C and which
alpha value is 30%. The Color Level 4 unofficial draft [1] provides
different notations for defining such a color value, but all of them force
the developer to perform some sort of conversion beforehand.

1. If the rgba() notation is chosen, one has to convert the hex color value
to the corresponding three integer components:

    #07C => 0, 119, 204

2. If the #RGBA notation is chosen, one has to convert the alpha value:

    30% => 255*0.3 (decimal) => 4D (hex)

The developer has to use tools to perform these conversions.It would be
good if it were possible to use the values #07C and 30% directly somehow
without having to perform manual conversions or rely on external tools. For
instance, he Sass CSS-pre-processor provides this notation:

    rgba( #07C, .3 )

I'm not saying that the above notation is ideal. It does however provide a
functionality that is currently missing in the CSS Color 4 draft - the
functionality of defining color values by combining hex base color and
decimal alpha values.

[1]: http://rawgithub.com/tabatkins/specs/master/css-color/Overview.html

-- @simevidas
Received on Tuesday, 7 May 2013 13:35:00 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 7 May 2013 13:35:00 UTC