node-vibrant
's internal packaging is now vastly more stable and improved. We'll continue to ship the default package with the same API as before, but now you can also import individual modules for more control over your environment.
- You now must import from
node-vibrant/browser
,node-vibrant/node
, ornode-vibrant/worker
to get the correct environment-specific implementation Vibrant
class is now a named export- Node 18+ is now required
- ES5 support is dropped
Vibrant.getPalette
no longer accepts aname
orcallback
API- Please migrate to the promise-based API to replace the
callback
API - Please let us know if you were using the
name
API: https://github.com/Vibrant-Colors/node-vibrant/issues- It was unclear how this was used in practice. We can reconsider adding it back if there's usecases I wasn't aware of
- Please migrate to the promise-based API to replace the
Vibrant.getPalettes
no longer accepts anames
orcallback
API- Please migrate to the promise-based API to replace the
callback
API - Please let us know if you were using the
names
API: https://github.com/Vibrant-Colors/node-vibrant/issues- It was unclear how this was used in practice. We can reconsider adding it back if there's usecases I wasn't aware of
- Please migrate to the promise-based API to replace the
Builder.getSwatches
alias was removed in favor of callingBuilder.getPalette
- Removed the deprecated
Builder.getHex
API, use theBuilder.hex
property instead - Removed the deprecated
Builder.getPopulation
API, use theBuilder.population
property instead - Removed the deprecated
Builder.getHsl
API, use theBuilder.hsl
property instead - Removed the deprecated
Builder.getRgb
API, use theBuilder.rgb
property instead - Workers are imported differently using the
?worker
import fix alias
node-vibrant
is now a monorepo. Building blocks of node-vibrant
has been separated into multiple small packages under @vibrant/*
scope. The goal is to make it more flexible, allowing alternative algorithms, additional image format support and etc to be implemented by 3rd party packages.
The node-vibrant
package still provides default experience out-of-box.
strickNullChecks
flag is now enabled.- Prebuilt bundle will not be provided. You should use your own
webpack
workflow.
- Fix empty swatches sometimes showing up for images
- Update deps
- Moved from Bluebird to native promises
- Fix issue with dist folder not appearing on install
- Fix issue with images not loading properly
Quantization is the most time-consuming stage in node-vibrant
. In v3.0, the quantization can be run in the WebWorker to avoid freezing the UI thread.
Here's how to use this feature:
- Use WebWorker build
dist/vibrant.worker.js
ordist/vibrant.worker.min.js
. Or if you are re-bundling with webpack, uselib/bundle.worker.js
as entry - Use WebWorker quantizer:
let v = Vibrant.from(src).useQuantizer(Vibrant.Quantizer.WebWorker); // Other configurations