color manipulation library
A random HSL color value generator and color manipulation library. Calculate complementary and analagous HSL color values.
The following conversions are included:
$ npm i @jgreulich/color
import color from 'color';
generateHSLColorArray
Generate a random HSL color as an array: [h, s, l].
generateHSLColorArray :: () -> [Number, Number, Number]
color.generateHSLColorArray() // [250, 100, 50]
hsl2hex
Return a Hex color from an HSL color.
hsl2hex :: ([Number, Number, Number]) -> String
color.hsl2hex([250, 100, 50]) // #2A00FF
hsl2hsv
Return an HSV color from an HSL color.
hsl2hsv :: (Number, Number, Number) -> [Number, Number, Number]
color.hsl2hsv(250, 100, 50) // [250, 100, 100]
hsl2rgb
Return an RGB color from an HSL color.
hsl2rgb :: ([Number, Number, Number]) -> [Number, Number, Number]
color.hsl2rgb(250, 100, 50) // [42, 0, 255]
hsv2hsl
Return an HSL color from an HSV color.
hsv2hsl :: (Number, Number, Number) -> [Number, Number, Number]
color.hsv2hsl(250, 100, 50) // [250, 100, 25]
rgb2hex
Return a Hex color from an RGB color.
rgb2hex :: (Number, Number, Number) -> String
color.rgb2hex(42, 0, 255) // #2A00FF
compColor
Calculate a complementary Hex color from an HSL color.
compColor :: ([Number, Number, Number]) -> String
color.compColor([250, 100, 50]) // #2A00FF
compColorInverse
Calculate an inverse light value complementary Hex color from an HSL color.
compColorInverse :: ([Number, Number, Number]) -> String
color.compColorInverse([250, 100, 50]) // #1E00B3
darkColor
Calculate an inverse light value Hex color from an HSL color (dark).
darkColor :: ([Number, Number, Number]) -> String
color.darkColor([250, 100, 50]) // #1E00B3
lightColor
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.