#

API Docs for: 3.10.3
Show: Inherited Protected Private Deprecated

# Color.HSL Class

Defined in: `color/js/color-hsl.js:1`
Module: color-hsl
Parent Module: color

Color provides static methods for color conversion to hsl values.

    Y.Color.toHSL('f00'); // hsl(0, 100%, 50%)

    Y.Color.toHSLA('rgb(255, 255, 0'); // hsla(60, 100%, 50%, 1)

- Index
- Methods
- Properties

## Item Index

### Methods

- _hslToRgb
- _hueToRGB
- _rgbToHsl
- toHSL
- toHSLA

### Properties

- REGEX_HSL static
- STR_HSL static
- STR_HSLA static

## Methods

### `_hslToRgb`

(

- `str`
- `[toArray]`

)
String | Array protected

Defined in `color/js/color-hsl.js:135`

Available since 3.8.0

Parses the HSL string into r, b, g values. Will return an Array of values or an RGB string.

#### Parameters:

- `str` String
- `[toArray]` Boolean optional

#### Returns:

String | Array:

### `_hueToRGB`

(

- `p`
- `q`
- `hue`

)
Number protected

Defined in `color/js/color-hsl.js:177`

Available since 3.8.0

Converts the HSL hue to the different channels for RGB

#### Parameters:

- `p` Number
- `q` Number
- `hue` Number

#### Returns:

Number: value for requested channel

### `_rgbToHsl`

(

- `str`
- `[toArray]`

)
String | Array protected

Defined in `color/js/color-hsl.js:69`

Available since 3.8.0

Parses the RGB string into h, s, l values. Will return an Array of values or an HSL string.

#### Parameters:

- `str` String
- `[toArray]` Boolean optional

#### Returns:

String | Array:

### `toHSL`

(

- `str`

)
String public

Defined in `color/js/color-hsl.js:43`

Available since 3.8.0

Converts provided color value to an HSL string.

#### Parameters:

- `str` String

#### Returns:

String:

### `toHSLA`

(

- `str`

)
String public

Defined in `color/js/color-hsl.js:56`

Available since 3.8.0

Converts provided color value to an HSLA string.

#### Parameters:

- `str` String

#### Returns:

String:

## Properties

### `REGEX_HSL`

RegExp static

Defined in `color/js/color-hsl.js:16`

Available since 3.8.0

Default: /hsla?\(([.\d]*), ?([.\d]*)%, ?([.\d]*)%,? ?([.\d]*)?\)/

### `STR_HSL`

String static

Defined in `color/js/color-hsl.js:25`

Available since 3.8.0

Default: hsl({*}, {*}%, {*}%)

### `STR_HSLA`

String static

Defined in `color/js/color-hsl.js:34`

Available since 3.8.0

Default: hsla({*}, {*}%, {*}%, {*})