Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

color-thief-node

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

color-thief-node

Color thief reimplementation for Node.js

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1K
decreased by-6.76%
Maintainers
1
Weekly downloads
 
Created
Source

Color Thief Node

Color thief reimplementation for Node.js.

The original color thief project relies on the browser Canvas object to extract pixels from images. It does not work well in Node.js environment because the Canvas object does not natively exist in Node.js.

This project, however, relies on the node-canvas library to simulate a Canvas object in Node.js environment. The source code has also been rewritten in ES6 fashion with support for promise.

Test

npm run test

or

yarn test

Installation

npm i color-thief-node

or

yarn add color-thief-node

Usage

Get the Dominant Color from an Image

const { getColorFromURL } = require('color-thief-node');

(async () => {
    const dominantColor = await getColorFromURL(imageURL);
})();

Build a Color Palette from an Image

const { getPaletteFromURL } = require('color-thief-node');

(async () => {
    const colorPallete = await getPaletteFromURL(imageURL);
})();

You can also check out test/index.test.js for more detailed example.

Keywords

FAQs

Package last updated on 20 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc