W3C home > Mailing lists > Public > www-style@w3.org > July 2014

[css-color] Exposing browser color parsing to JS

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 7 Jul 2014 16:27:17 -0700
Message-ID: <CAAWBYDCWVRni9U8rbdnKH4xfm8PMLPdg2G-ULHZ+ECfTASkKpA@mail.gmail.com>
To: www-style list <www-style@w3.org>
One of my coworkers brought my attention to
a library that does basic color manipulation and
parsing/serialization.  I've seen this sort of thing multiple times,
and even wrote my own (<http://www.xanthir.com/etc/color.js>).  I've
also had to write a fairly complete color parser in PHP in the past.

Given that most/all of this machinery already exists in the browser,
it's kinda sad that people have to keep reinventing it.  What would
y'all think about introducing a bit of a helper for this kind of
thing, that exposes all of the parsing and serialization the browser
does, and is easily extensible so authors can use it as the basis for
their own color-using code?

Here's my first draft of a proposal for it:

Note that this intentionally does not try to interface deeply with the
OM, as that's meant to be saved for the future OM upgrade based on
value objects.  You can assign an RGBAColor directly to a CSS
property, but it'll just stringify (which will have the intended

Received on Monday, 7 July 2014 23:28:07 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:14:42 UTC