You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
preferred (lighter or more modern alternative package)
Rationale
@img/colour is just a port of the color package to CommonJS. It is just better to switch back to color and use ESM, which allows for better tree-shaking.
@img/colour was updated more recently, has fewer deps, and is smaller.
i wonder if the right move here is to ask them to go ESM-only and rework their README to no longer be just a CJS port - but rather just be the more modern alternative.
@img/colour is solely used by sharp and sharp-related projects, meaning there is a bigger chance it might get abandoned.
@img/colour is not its own library, it is built by generating cjs compatible code from color and its sub-dependencies like color-convert into a single file. It reduces portability, but at the same time reduces the final size (less readmes, less files), giving that 20kB size difference.
color library has some problems like missing oklch support, but given that @img/colour is not a fork, it is just a library that rebuilds it for CommonJS, I think the migration to color is the right choice and we should continue improving that library.
There might be other alternatives like colorjs.io which is more modern (supports CSS Color 4), but it weights 13.2 MB instead of 91.5 kB, has different API and probably it's own caveats.
ill wait for a 2nd opinion from core but i think color should be used here even though it is slightly bigger (because it isn't minified). it'll de-dupe better
+1 for color here, agree with the direction, it is worth being clear about what @img/colour actually is, not a fork or an alternative, just an esbuild bundle of color regenerated for cjs. the size argument also cuts the other way in practice, the 20kb is mostly install size (readmes, unbundled files), and color / color-conver / color-string are already in half ecosystem's trees, so depending on color dedupes while @img/colour ships the same code again as an opaque build.
one thing the migration notes should call out: color@5 is esm-only, and the whole audience for @img/colour is cjs consumers, without it the before/after swap can be a bit misleading.
Activity
43081j commentedon Jul 7, 2026
hmm we should dig into this a bit...
@img/colourwas updated more recently, has fewer deps, and is smaller.i wonder if the right move here is to ask them to go ESM-only and rework their README to no longer be just a CJS port - but rather just be the more modern alternative.
Norbiros commentedon Jul 7, 2026
@img/colouris solely used bysharpand sharp-related projects, meaning there is a bigger chance it might get abandoned.@img/colouris not its own library, it is built by generatingcjscompatible code fromcolorand its sub-dependencies likecolor-convertinto a single file. It reduces portability, but at the same time reduces the final size (less readmes, less files), giving that 20kB size difference.colorlibrary has some problems like missingoklchsupport, but given that@img/colouris not a fork, it is just a library that rebuilds it for CommonJS, I think the migration tocoloris the right choice and we should continue improving that library.Norbiros commentedon Jul 7, 2026
There might be other alternatives like
colorjs.iowhich is more modern (supportsCSS Color 4), but it weights13.2 MBinstead of91.5 kB, has different API and probably it's own caveats.43081j commentedon Jul 7, 2026
you are right 👍
ill wait for a 2nd opinion from core but i think
colorshould be used here even though it is slightly bigger (because it isn't minified). it'll de-dupe betterdreyfus92 commentedon Jul 8, 2026
+1 for
colorhere, agree with the direction, it is worth being clear about what@img/colouractually is, not a fork or an alternative, just an esbuild bundle ofcolorregenerated for cjs. the size argument also cuts the other way in practice, the 20kb is mostly install size (readmes, unbundled files), andcolor/color-conver/color-stringare already in half ecosystem's trees, so depending oncolordedupes while@img/colourships the same code again as an opaque build.one thing the migration notes should call out:
color@5is esm-only, and the whole audience for@img/colouris cjs consumers, without it the before/after swap can be a bit misleading.preferredtype sounds right to me