Skip to main content

HSL

Hue, Saturation, Lightness

Hue value is between 0 and 360. Saturation, lightness, and alpha are between 0 and 100 (as in, percent).

New Color

Color.from('hsl',[h, s, l, a?])

Conversion to

.to('hsl',{
round: boolean // optional, default = true
})

Get methods

.getH(): number
.getS(): number
.getL(): number
.getA(): number // if alpha is not set, defaults to 100

JavaScript

const Color = require('chromaticity-color-utilities')

const color1 = Color.from('hsl', [300, 100, 50])
const color3 = color2.to('hsl')

TypeScript

import Color from 'chromaticity-color-utilities'

const c: Color.hsl = Color.from('hsl', [300, 100, 50])