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

@sunpietro/color-finder

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sunpietro/color-finder

It's a small library that allows to find similar color in a given group of colors. Calculations are made Euclidean distance between 2 CIELab color definitions.

  • 0.10.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

@sunpietro/color-finder

Checks the distance between 2 hex colors and finds the closest color to a given sample.

Installation

npm install @sunpietro/color-finder

How to use it?

import ColorFinder from `@sunpietro/color-finder`;

const colorsLibrary = [
  '#bb3300',
  '#aa22ff',
  '#b00053'
];
const finder = ColorFinder(colorsLibrary);

Available methods

There are finder methods available:

updateColorsLibrary

Updates a collection of colors used for comparing with sample colors. Takes one param: colors as string[].

findClosestColor

Finds the closest color to a sample color, in a colors library. Takes one param: color as string. Returns the closest color as string.

checkColorsSimilarity

Compares 2 hex colors in terms of color similarity. Takes two params: color1 as string and color2 as string. Returns an Euclidean distance value as number. The lowest value, the more similar colors are.

Keywords

FAQs

Package last updated on 31 Aug 2020

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