JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 407261
  • Score
    100M100P100Q176603F
  • License BSD

Implemets the CIEDE2000 color difference algorithm, conversion between RGB and LAB color and mapping all colors in palette X to the closest color in palette Y based on the CIEDE2000 difference.

Package Exports

  • color-diff
  • color-diff/lib/diff

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (color-diff) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Color-diff

Implemets the CIEDE2000 color difference algorithm, conversion between RGB and LAB color and mapping all colors in palette X to the closest color in palette Y based on the CIEDE2000 difference.

Installation

npm install color-diff --save

Usage

var diff = require('color-diff');

diff.closest(color, palette)

Returns the closest color.

var color = { R: 255, G: 1, B: 30 };
// red, green, blue
var palette = [ {R: 255, G: 0, B: 0 }, {R: 0, G: 255, B: 0 }, {R: 0, G: 0, B: 255} ];

diff.closest(color, palette); // {R: 255, G: 0, B: 0 }, red

The result above is obvious, but diff.closest could deal with more complicated cases.

color

Object

color is an object containing 3 properties: 'R', 'G', 'B', such as:

{ R: 255, G: 1, B: 0 }
```	

#### palette

`Array.<Object>`

Color palette array which contains many `color`-like objects.


## Author
Markus Näsman

## License
See COPYING