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

Re: [css-color] Exposing browser color parsing to JS

From: Lea Verou <lea@verou.me>
Date: Fri, 11 Jul 2014 19:55:04 +0300
Cc: www-style list <www-style@w3.org>
Message-Id: <B5952EF0-30DD-42F5-8F81-F1205D259332@verou.me>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
On Jul 11, 2014, at 07:13, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
> You seem to have missed the asHSL() function (and related one for hex).
True.

> Note that the argument is optional, and has a default, so normal
> stringifying will work just fine.
I know, but I still find it inconsistent with other JS APIs.

> I used "RGBAColor" specifically because it is an RGBA color; the
> default attributes exposed are for RGBA.
> [snip]
> device-cmyk() is RGBA-compatible.  By necessity, all CSS colors must be.
Just because CMYK colors can be converted to RGB, doesn’t mean they are equivalent. I think there’s value in having a generic Color class, that could represent both RGBA and CMYK colors (without converting them to RGBA internally). 

> What is this in reference to?  Is this just a request for a distance
> function?  It sounds like a complaint about something in the proposal,
> which is confusing me.
Sorry, that was in reply to another message in the thread, I just wrote them all in one email. Specifically this: 

On Jul 9, 2014, at 08:46, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
>> how about a way to get the color name for an rgb value?
> 
> Sounds good.  Should you just round to the nearest named color?
> "Nearest" meaning "shortest distance in euclidean RGB space, with some
> arbitrary tie-breaking method as well"?

...but a distance method would be nice too of course :)

> It's not tied to the DOM in any way.  What makes you think that?

It was a reply to a few other messages that suggested adding methods that accept element references as parameters, to resolve things like currentColor, inherit etc.

~Lea
Received on Friday, 11 July 2014 16:55:35 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:23 UTC