All Projects → markusn → Color Diff

markusn / Color Diff

Licence: other
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.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Color Diff

hcv-color
🌈 Color model HCV/HCG is an alternative to HSV and HSL, derived by Munsell color system, usable for Dark and Light themes... 🌈
Stars: ✭ 44 (-85.14%)
Mutual labels:  palette, rgb
Color.js
Extract colors from an image (0.75 KB) 🎨
Stars: ✭ 42 (-85.81%)
Mutual labels:  palette, rgb
Fastlayerdecomposition
fast layer decomposition and updating
Stars: ✭ 20 (-93.24%)
Mutual labels:  palette, rgb
Libimagequant
Palette quantization library that powers pngquant and other PNG optimizers
Stars: ✭ 344 (+16.22%)
Mutual labels:  conversion, palette
Colourful
🎨 Open source .NET library for working with color spaces.
Stars: ✭ 161 (-45.61%)
Mutual labels:  conversion, rgb
Pngquant
Lossy PNG compressor — pngquant command based on libimagequant library
Stars: ✭ 4,086 (+1280.41%)
Mutual labels:  conversion, palette
Xcodecolorsense
🎈 An Xcode plugin that makes working with color easier
Stars: ✭ 79 (-73.31%)
Mutual labels:  palette, rgb
Color
A little library to deal with color conversions
Stars: ✭ 166 (-43.92%)
Mutual labels:  conversion, rgb
vscode-color
Helper with GUI to generate color codes such as CSS color notations.
Stars: ✭ 88 (-70.27%)
Mutual labels:  palette, rgb
emerald
emerald - simple color palette tool
Stars: ✭ 23 (-92.23%)
Mutual labels:  palette
Henkan
A small library for converting between case classes.
Stars: ✭ 262 (-11.49%)
Mutual labels:  conversion
govee btled
A Python wrapper for controlling a cheap Bluetooth RGB light bulb.
Stars: ✭ 50 (-83.11%)
Mutual labels:  rgb
rocksmithconvert
Simple standalone OSX app to convert Rocksmith 2014 .psarc (CDLC) files between PC and MAC.
Stars: ✭ 45 (-84.8%)
Mutual labels:  conversion
Razer Laptop Control
Project to create driver/software to control performance of razer laptops
Stars: ✭ 268 (-9.46%)
Mutual labels:  rgb
ACVR2017
An Innovative Salient Object Detection Using Center-Dark Channel Prior
Stars: ✭ 20 (-93.24%)
Mutual labels:  rgb
Polychrome
🎨 Easy color manipulation in ~2kb (gzipped)
Stars: ✭ 286 (-3.38%)
Mutual labels:  palette
sublime-atomizr
Convert Sublime Text completions into Atom (or Visual Studio Code) snippets, and vice versa.
Stars: ✭ 12 (-95.95%)
Mutual labels:  conversion
php-unit-conversion
A library providing full PSR-4 compatible unit conversions
Stars: ✭ 47 (-84.12%)
Mutual labels:  conversion
Length.js
📏 JavaScript library for length units conversion.
Stars: ✭ 292 (-1.35%)
Mutual labels:  conversion
Msirgb
Alternative to MSI Mystic Light for controlling motherboard LEDs, without the fixed 7 colour limitation.
Stars: ✭ 276 (-6.76%)
Mutual labels:  rgb

Color-diff

Build Status Coverage Status

Implements 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

Tests

Are located in the test/ folder and are run by:

npm test

Usage

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

diff.closest(color, palette, bc)

Returns the closest color. The parameter bc is optional and is used as background color when the color and/or palette uses alpha channels.

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.

diff.furthest(color, palette, bc)

Returns the most different color. The parameter bc is optional and is used as background color when the color and/or palette uses alpha channels.

var color = { R: 255, G: 255, B: 255 };
// black, white
var palette = [ {R: 0, G: 0, B: 0 }, {R: 255, G: 255, B: 255 } ];

diff.furthest(color, palette); // {R: 0, G: 0, B: 0 }, black

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

diff.map_palette(palette1, palette2)

Returns a mapping from the colors in palette1 to palette2.

color

Object

color is an object containing 3 properties: 'R', 'G', 'B' (case insensitive), such as:

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

There is an optional property 'A', which specifies the alpha channel between 0.0 and 1.0.

Each RGBA-color is transformed into a RGB-color before being used to calculate the CIEDE2000 difference, using the specified background color (defaults to white).

palette

Array.<Object>

Color palette array which contains many color-like objects.

Author

Markus Ekholm

License

3-clause BSD. For details see COPYING.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].