A random HSL color value generator and color manipulation library. Calculate complementary and analagous HSL color values.
The following conversions are included:
- HSL to Hex
- HSL to HSV
- HSL to RGB
- HSV to HSL
- RGB to Hex
$ npm i @jgreulich/color
import color from 'color';
Generate a random HSL color as an array: [h, s, l].
generateHSLColorArray :: () -> [Number, Number, Number]
color.generateHSLColorArray() // [250, 100, 50]
Return a Hex color from an HSL color.
hsl2hex :: ([Number, Number, Number]) -> String
color.hsl2hex([250, 100, 50]) // #2A00FF
Return an HSV color from an HSL color.
hsl2hsv :: (Number, Number, Number) -> [Number, Number, Number]
color.hsl2hsv(250, 100, 50) // [250, 100, 100]
Return an RGB color from an HSL color.
hsl2rgb :: ([Number, Number, Number]) -> [Number, Number, Number]
color.hsl2rgb(250, 100, 50) // [42, 0, 255]
Return an HSL color from an HSV color.
hsv2hsl :: (Number, Number, Number) -> [Number, Number, Number]
color.hsv2hsl(250, 100, 50) // [250, 100, 25]
Return a Hex color from an RGB color.
rgb2hex :: (Number, Number, Number) -> String
color.rgb2hex(42, 0, 255) // #2A00FF
Calculate a complementary Hex color from an HSL color.
compColor :: ([Number, Number, Number]) -> String
color.compColor([250, 100, 50]) // #2A00FF
Calculate an inverse light value complementary Hex color from an HSL color.
compColorInverse :: ([Number, Number, Number]) -> String
color.compColorInverse([250, 100, 50]) // #1E00B3
Calculate an inverse light value Hex color from an HSL color (dark).
darkColor :: ([Number, Number, Number]) -> String
color.darkColor([250, 100, 50]) // #1E00B3
Calculate a lighter value Hex color from an HSL color.
lightColor :: ([Number, Number, Number]) -> String
color.lightColor([250, 100, 50]) // #4019FF
Copyright 2019, Jessica Greulich. Licensed under the ISC License.
Inspired by Adobe Color.