color-js / color-js/elements

Components should handle complex color values gracefully

Open
#212 0 comments 0 reactions 1 assignee Claimed by @DmitrySharabin View on GitHub
Dominant language
JavaScript
Stars
30
Forks
4
PR merge metrics
No merged PRs in 30d

Description

The set of colors that Color.js can parse and that browsers can parse are overlapping but not identical, and neither is a subset of the other.
Color.js understands color spaces that browsers do not, but also browsers support things like `color-mix()`, CSS variables, relative colors etc.

A big improvement would be to introduce an extra step: If parsing fails, try `CSS.supports('color', color)`. If that is true, use `getComputedStyle()` to resolve color ([demo](https://codepen.io/leaverou/pen/pvjPPVZ?editors=1111)), then proceed as normal. `getComputedStyle()` calls are expensive, so it's important to keep them to a minimum and cache the results.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.