node-vibrant is a JavaScript library engineered for extracting prominent colors and generating a color palette from images. It effectively analyzes image data to produce a set of 'swatches,' including vibrant, muted, dark vibrant, light vibrant, dark muted, and light muted colors. The library is currently at stable version 4.0.4 and has resumed active development following a substantial four-year hiatus before the significant 4.0.0 release. Key features include comprehensive support for both Node.js and browser environments, a full rewrite in TypeScript since version 3.0.0-alpha.1, and a modern Promise-based API for handling asynchronous operations. This combination makes it a robust solution for applications requiring dynamic, type-safe color palette generation from images, integrating smoothly with contemporary JavaScript development workflows.
npm install node-vibrantVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to extract a color palette from an image URL using the Promise-based API in a Node.js environment, displaying the dominant color swatches.
Change your import statement to `import { Vibrant } from 'node-vibrant/node;'` or `import { Vibrant } from 'node-vibrant/browser;'` depending on your environment.Update your import paths to explicitly target your environment, e.g., `import { Vibrant } from 'node-vibrant/node;'`.Upgrade your Node.js environment to version 18 or higher.
Refactor your asynchronous operations to use Promises, for example: `Vibrant.from(imageUrl).getPalette().then(palette => ...);` or `const palette = await Vibrant.from(imageUrl).getPalette();`
Replace calls to `getSwatches()` with `getPalette()`.
Ensure you are using `import { Vibrant } from 'node-vibrant/node';` (or `/browser`) and then `Vibrant.from(...)`.For v4.0.0 and later, specify the environment in the import path: `import { Vibrant } from 'node-vibrant/node';` or `import { Vibrant } from 'node-vibrant/browser';`Ensure you are `await`ing the `getPalette()` call within an `async` function or chaining a `.then()` callback: `await Vibrant.from(imageUrl).getPalette();` or `Vibrant.from(imageUrl).getPalette().then(...)`.
No dependency data recorded yet.