@sunpietro/color-finder
TypeScript icon, indicating that this package has built-in type declarations

0.10.2 • Public • Published

@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.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.10.21latest

Version History

VersionDownloads (Last 7 Days)Published
0.10.21
0.10.10

Package Sidebar

Install

npm i @sunpietro/color-finder

Weekly Downloads

1

Version

0.10.2

License

MIT

Unpacked Size

21.4 kB

Total Files

14

Last publish

Collaborators

  • sunpietro