alexcambose / color-to-color

Transform color to color based on percentage

Home Page:https://codesandbox.io/s/382j03rm86

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

Transform color to color based on percentage

https://codesandbox.io/s/382j03rm86


Languages

Language:JavaScript 100.0%