1.0.0 • Published 1 year ago

@sahilkathpal/aesthetic-hue-bg v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

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}   
});