0.0.1 • Published 6 years ago
@jgreulich/color v0.0.1
color
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
Installation
$ npm i @jgreulich/colorUsage
import color from 'color';Methods
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]) -> Stringcolor.hsl2hex([250, 100, 50]) // #2A00FFhsl2hsv
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) -> Stringcolor.rgb2hex(42, 0, 255) // #2A00FFcompColor
Calculate a complementary Hex color from an HSL color.
compColor :: ([Number, Number, Number]) -> Stringcolor.compColor([250, 100, 50]) // #2A00FFcompColorInverse
Calculate an inverse light value complementary Hex color from an HSL color.
compColorInverse :: ([Number, Number, Number]) -> Stringcolor.compColorInverse([250, 100, 50]) // #1E00B3darkColor
Calculate an inverse light value Hex color from an HSL color (dark).
darkColor :: ([Number, Number, Number]) -> Stringcolor.darkColor([250, 100, 50]) // #1E00B3lightColor
Calculate a lighter value Hex color from an HSL color.
lightColor :: ([Number, Number, Number]) -> Stringcolor.lightColor([250, 100, 50]) // #4019FFLicense
Copyright 2019, Jessica Greulich. Licensed under the ISC License.
Acknowledgments
Inspired by Adobe Color.
0.0.1
6 years ago