setHsl()
The setHsl
function allows you to modify the HSL (Hue, Saturation, Lightness) values of a color object.
This function returns a new Spectrum
instance with the updated HSL values.
Usage
Parameters
setHsl(colorObj, options)
Parameter | Type | Required | Valid range | Description |
---|---|---|---|---|
colorObj | Spectrum instance | true | - | The Spectrum instance representing the color you want to modify |
options.hue | number | false | [0; 360] | The value that will be set as a hue value |
options.saturation | number | string | false | [0; 1] or ['0%'; '100%'] | The value that will be set as a saturation value |
options.lightness | number | string | false | [0; 1] or ['0%'; '100%'] | The value that will be set as a lightness value |
options.alpha | number | string | false | [0; 1] or ['0%'; '100%'] | The value that will be set as an alpha value |
Return Value
The setHsl
function returns a new Spectrum
instance with the modified HSL values.