Skip to content

alexcambose/color-to-color

Repository files navigation

color-to-color

Coverage Status Build Status JavaScript Style Guide

Transform color to color based on percentage

Edit 382j03rm86

Install

With npm

npm i color-to-color -S

Usage

const c2c = require("color-to-color");
const fromColor = 'red';
const toColor = 'blue';
c2c(fromColor).toColor(toColor).withPercent(50).get(); // { r: 127, g: 0, b: 127 }

c2c(fromColor).toColor(toColor).withPercent(28).get('rgb'); // rgb(183, 0, 71)
c2c(fromColor).toColor(toColor).withPercent(50).get('hex'); // #7F007F
c2c(fromColor).toColor(toColor).withPercent(100).get('hsl'); // hsl(0, 0%, 255%)
c2c(fromColor).toColor(toColor).withPercent(84).get('hwb'); // hwb(40, 0%, 214%)

c2c(fromColor).toColor(toColor).withPercent(0).get('keyword'); // red
c2c(fromColor).toColor(toColor).withPercent(100).get('keyword'); // blue
c2c(fromColor).toColor(toColor).withPercent(65).get('keyword'); // undefined

License

MIT

Releases

No releases published

Packages

No packages published