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

On 7/7/14, 8:48 PM, Simon Sapin wrote:
> A trick I’ve seen in stuff made by Lea Verou to use the browser’s color
> parsing code is to set e.g. someElement.style.color to the string to
> parse, then get getComputedStyle(someElement).color, which is in rgb()
> or rgba() format and much easier to hand-parse.

While this is doable, it has a few drawbacks:

1)  It's slower than a custom API for parsing colors.
2)  It can't be done in workers, whereas exposing color parsing in
     particular may not be too super-terrible in workers.

-Boris

Received on Tuesday, 8 July 2014 01:29:00 UTC