aesthetic-hue-bg
A library to pull the dominant colour from an image and provide aesthetic background and border stroke colours.
Currently intended for creating backgrounds for link previews based on the favicon, this library supports only png and ico formats.
Installation
npm install @sahilkathpal/aesthetic-hue-bg --save
This package is intended for use in node environments. It won't work in a browser because it has node-specific dependencies.
Usage
const fs = require('fs');
const linkColour = require('aesthetic-hue-bg');
const buffer = fs.readFileSync("./test-images/bitcoin.ico");
const colours = linkColour.fetchColors(buffer, "image/x-icon").then((colors) => {
// 'colors' is a JSON object {'fill': some-hex-code, 'stroke': some-other-hex-code}
});