@tempots/color

HSL class

Represents a color in the HSL (Hue, Saturation, Lightness) color model.

Signature:

declare class HSL 

Constructors

Constructor

Modifiers

Description

(constructor)(hue, saturation, lightness)

Constructs a new instance of the HSL class

Properties

Property

Modifiers

Type

Description

equals

readonly

(other: HSL, tollerance?: number) => boolean

Checks if the current HSL color is equal to another HSL color.

fromString

static

readonly

(s: string) => HSL

Creates an HSL color object from a string representation. The string should be in the format "hsl(h, s%, l%)".

hue

readonly

number

The hue value of the HSL color.

lightness

readonly

number

Represents the lightness value in the HSL color model.

ofChannels

static

readonly

([hue, saturation, lightness]: [hue: number, saturation: number, lightness: number]) => HSL

Creates an HSL color instance from individual channel values.

saturation

readonly

number

The saturation value of an HSL color.

toChannels

readonly

() => [number, number, number]

Converts the HSL color values to an array of channels.

toString

readonly

() => string

Returns a string representation of the HSL color in the format "hsl(hue, saturation%, lightness%)".

withHue

readonly

(hue: number) => HSL

Returns a new HSL color with the specified hue.

withLightness

readonly

(lightness: number) => HSL

Returns a new HSL color with the specified lightness.

withSaturation

readonly

(saturation: number) => HSL

Returns a new HSL color with the specified saturation.