Color.HSL Class
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
_hslToRgb
(
String | Array
protected
-
str
-
[toArray]
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
(
Number
protected
-
p
-
q
-
hue
Converts the HSL hue to the different channels for RGB
Returns:
Number:
value for requested channel
_rgbToHsl
(
String | Array
protected
-
str
-
[toArray]
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
(
String
public
-
str
Converts provided color value to an HSL string.
Parameters:
-
str
String
Returns:
String:
toHSLA
(
String
public
-
str
Converts provided color value to an HSLA string.
Parameters:
-
str
String
Returns:
String:
Properties
REGEX_HSL
RegExp
static
Default: /hsla?\(([.\d]*), ?([.\d]*)%, ?([.\d]*)%,? ?([.\d]*)?\)/
STR_HSL
String
static
Default: hsl({*}, {*}%, {*}%)
STR_HSLA
String
static
Default: hsla({*}, {*}%, {*}%, {*})