hwbToHsl()
The hwbToHsl function allows you to convert an HWB color value to its
corresponding HSL value.
Usage
import { hwbToHsl } from '@snipshot/spectrum';
const salmon = hwbToHsl({ h: 6, w: 0.44, b: 0.02, a: 1 });
console.log(salmon); // { h: 6, s: 0.93, l: 0.71, a: 1 }Parameters
hwbToHsl(hslObj)
| Parameter | Type | Required | Description |
|---|---|---|---|
hwbObj | HwbObj | true | An HWB object that represents a color in the HWBA (Hue, Whiteness, Blackness, Alpha) color space. |
Return Value
The hwbToHsl function returns an HSL object of the color
value.
Examples
With opacity
import { hwbToHsl } from '@snipshot/spectrum';
const teal = hwbToHsl({ h: 180, w: 0, b: 0.5, a: 0.75 });console.log(teal); // { h: 180, s: 1, l: 0.25, a: 0.75 }
const violet = hwbToHsl({ h: 300, w: 0.51, b: 0.07, a: 0.32 });console.log(violet); // { h: 300, s: 0.76, l: 0.72, a: 0.32 }