Color provides static methods for color conversion.
Y.Color.toRGB('f00'); // rgb(255, 0, 0)
Y.Color.toHex('rgb(255, 255, 0)'); // #ffff00
_convertTo
clr
to
Converts the provided color string to the value type provided as to
_getAlpha
clr
Retrives the alpha channel from the provided string. If no alpha
channel is present, 1
will be returned.
clr
String
_hexToRgb
str
[toArray]
Processes the hex string into r, g, b values. Will return values as an array, or as an rgb string.
_keywordToHex
clr
Returns the hex value string if found in the KEYWORDS object
clr
String
_rgbToHex
str
[toArray]
Processes the rgb string into r, g, b values. Will return values as an array, or as a hex string.
findType
str
Finds the value type based on the str value provided.
str
String
fromArray
arr
template
Converts the array of values to a string based on the provided template.
toArray
str
Converts the provided color string to an array of values. Will return an empty array if the provided string is not able to be parsed.
str
String
toHex
str
Converts provided color value to a hex value string
str
String
Hex or RGB value string
REGEX_RGB
Default: /rgba?\(([0-9]{1,3}), ?([0-9]{1,3}), ?([0-9]{1,3}),? ?([.0-9]{1,3})?\)/