Skip to content

matiassingers/color-delta

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

color-delta Build Status Dependency Status Coverage Status

calculate the diff between 2 colors

Accepts almost all types of color strings, see TinyColor for more info.

Partially extracted from Sass Colour Function Calculator.

Install

$ npm install --save color-delta

Usage

var colorDelta = require('color-delta');

colorDelta('#BADA55', '#B0BCA7', 2)
// => { hue: 19.84, saturation: ... }

CLI

$ npm install --global color-delta
$ color-delta --help

  calculate the diff between 2 colors

  Example
    color-delta #bada55 #b0bca7
    => {
         "hue": 19.849624060150404,
         "saturation": 0.5070282063269438,
         "lightness": -0.10196078431372546
       }

API

colorDelta(base, target, [decimals])

base

Required
Type: String

Base color to calculate difference from.

target

Required
Type: String

Target color to calculate difference to.

decimals

Optional
Type: String

Fixed number of decimals in returned values.

Related

License

MIT © Matias Singers

About

calculate the diff between 2 colors

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published