drwpow / better-color-tools

Better color tools for JS, TS, and Sass. Supports Oklab and CSS Color Module 4.
https://better-color-tools.pages.dev/
MIT License
78 stars 7 forks source link

Goodbye, better-color-tools #45

Open drwpow opened 11 months ago

drwpow commented 11 months ago

👋 After a couple years of working on this library in the background (late 2021), several notable events have happened that don’t make this worth maintaining for me:

oklab() / oklch() landed in all browsers

CleanShot 2023-07-27 at 20 42 29@2x

This is now supported in CSS in all major browsers (~86% as of Jul 2023) 🎉. There’s no JS tool that compete with a built-in CSS feature. Why use an npm package for something the web platform gives you for free?

color-mix() landed AND supports Oklab mixing

Mixing colors through Oklab via color-mix() is now supported in CSS in all major browsers, and is safe to use in web projects today.

Culori also got Oklab support

Culori added Oklab/Oklch support, and if you use the “tree-shakeable” version of colori/fn, you can basically get the footprint of better-color-tools at only a few kB gzip, but with a more stable library and support for more options.

Oh, and did I mention culori/fn is a whopping 5-10× faster than this library for the same package size? 🚀🚀🚀

  culori - test/better.bench.ts > rgb -> hex
    6.69x faster than better

  culori - test/better.bench.ts > rgb -> p3
    4.97x faster than better

  culori - test/better.bench.ts > hsl -> rgb
    8.45x faster than better

  culori - test/better.bench.ts > rgb -> oklab
    6.21x faster than better

  culori - test/better.bench.ts > rgb -> oklch
    5.98x faster than better

  culori - test/better.bench.ts > parse speed: hex string
    10.30x faster than better

Frankly, I don’t have the resources to try and tune better-color-tools to be that fast.


All of the above are developments I have welcomed, and couldn’t be happier for 🙂. But it’s made maintaining this library not worth the effort.

Though I considered the possibility of this library simply wrapping culori/fn, I’m not going to do that. Because creating unnecessary abstractions don’t make a good npm package.

Thanks to all those who tried this library and liked the API. But migrating to culori/fn for all your color needs will not only yield a better experience; you’ll also be contributing to better color science tools. And in the end, that’s what matters. 🎨