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/workerto get the correct environment-specific implementation Vibrantclass is now a named export- Node 18+ is now required
- ES5 support is dropped
Vibrant.getPaletteno longer accepts anameorcallbackAPI- Please migrate to the promise-based API to replace the
callbackAPI - Please let us know if you were using the
nameAPI: 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.getPalettesno longer accepts anamesorcallbackAPI- Please migrate to the promise-based API to replace the
callbackAPI - Please let us know if you were using the
namesAPI: 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.getSwatchesalias was removed in favor of callingBuilder.getPalette- Removed the deprecated
Builder.getHexAPI, use theBuilder.hexproperty instead - Removed the deprecated
Builder.getPopulationAPI, use theBuilder.populationproperty instead - Removed the deprecated
Builder.getHslAPI, use theBuilder.hslproperty instead - Removed the deprecated
Builder.getRgbAPI, use theBuilder.rgbproperty instead - Workers are imported differently using the
?workerimport 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.
strickNullChecksflag is now enabled.- Prebuilt bundle will not be provided. You should use your own
webpackworkflow.
- 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.jsordist/vibrant.worker.min.js. Or if you are re-bundling with webpack, uselib/bundle.worker.jsas entry - Use WebWorker quantizer:
let v = Vibrant.from(src).useQuantizer(Vibrant.Quantizer.WebWorker); // Other configurations