Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Intent to implement and ship: #rgba and #rrggbbaa color syntax in CSS

100 views
Skip to first unread message

L. David Baron

unread,
May 9, 2016, 1:36:33 AM5/9/16
to dev-pl...@lists.mozilla.org
I just landed a patch to implement the #rgba and #rrggbbaa syntax
for colors in CSS, and realized I probably should have sent an
intent to dev-platform slightly sooner.

This is an additional syntax for an existing feature already usable
as the rgba() and hsla() color functions, commonly requested by
developers, and recently implemented in both Chromium and WebKit. I
figured we may as well add it now both because it's popular and
because we're likely to have to for compatibility soon enough.

It allows, for example, the color previously specifiable as
rgba(221, 34, 170, 0.6) or to be specified as #d2a9 or #dd22aa99.
(rgb(221, 34, 170) has always been specifiable as #d2a or #dd22aa;
this just extends the compact hexadecimal syntax to allow alpha.)

It affects only colors specified in CSS, and not those specified in
HTML attributes.

Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=567283
Spec: https://drafts.csswg.org/css-color-4/#hex-notation
Target release: Firefox 49

-David

--
𝄞 L. David Baron http://dbaron.org/ 𝄂
𝄢 Mozilla https://www.mozilla.org/ 𝄂
Before I built a wall I'd ask to know
What I was walling in or walling out,
And to whom I was like to give offense.
- Robert Frost, Mending Wall (1914)
signature.asc

Patrick Brosset

unread,
May 9, 2016, 3:02:29 AM5/9/16
to L. David Baron, dev-platform, dev-developer-tools
(cross posting to dev-developer-tools)

I just filed the following bug for devtools support:
https://bugzilla.mozilla.org/show_bug.cgi?id=1271191

Right now, the devtools inspector panel displays CSS colors (in the Rules
sidebar panel) as editable color swatches, and allows to convert between
the various formats.
This bug aims at supporting #rgba and #rrggbbaa
> _______________________________________________
> dev-platform mailing list
> dev-pl...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-platform
>
>

Jet Villegas

unread,
May 9, 2016, 2:48:09 PM5/9/16
to L. David Baron, group, mozilla.dev.platform
On Sun, May 8, 2016 at 10:35 PM, L. David Baron <dba...@dbaron.org> wrote:

> I just landed a patch to implement the #rgba and #rrggbbaa syntax
> for colors in CSS,
>

Nice!


> It affects only colors specified in CSS, and not those specified in
> HTML attributes.
>
> Is this a follow-up, or are we prevented from parsing extended HTML color
attributes by some other invariant?

Thanks,

--Jet

L. David Baron

unread,
May 9, 2016, 3:15:30 PM5/9/16
to j...@mozilla.com, dev-pl...@lists.mozilla.org
On Monday 2016-05-09 11:42 -0700, Jet Villegas wrote:
> Is this a follow-up, or are we prevented from parsing extended HTML color
> attributes by some other invariant?

Colors in HTML use a parsing algorithm that basically accepts all
garbage, and people depend on that, so we're probably unable to
accept new syntax for HTML colors.
signature.asc
0 new messages