npm.io
1.0.1 • Published 5 years ago

percent-to-hex

Licence
ISC
Version
1.0.1
Deps
2
Size
2 kB
Vulns
0
Weekly
0
Stars
1

Percent to HEX package

Converts percent value (between 0 and 1) to HEX color code (between green and red)

Install

npm i percent-to-hex

Usage with default saturation (100%) and default lightness (50%)

const percentToHex = require('percent-to-hex');

percentToHex(1) // output: "#ff0000"
percentToHex(0.5) // output: "#ffff00"
percentToHex(0) // output: "#00ff00"
Usage with custom saturation & lightness:
const percentToHex = require('percent-to-hex');

percentToHex([0.5,85,60]) // output: "#f0f042"

Keywords