Another JS color library?
Mike Bostock's d3-color, and Gregor Aisch's chroma.js are two excellent, robust libraries that provide most of what you need for working with colors on the web. The Resources section for even more libraries you can try.
Culori does a few things differently:
- On the
alphachannel, the library doesn't equate an
undefinedvalue with an opaque color, but rather with a color for which we don't care about the opacity. This gives you the opportunity to interpret
undefinedas you see fit. The hex string #ff0000 should probably be rendered as fully opaque red, but for running functions on colors it's useful to discern #ff0000 from #ff0000ff — the former has an implicit alpha of 1, while for the latter it's explicit.