Color

Color

Methods

(static) cutHex(hex) → {String}

Source:
Remove the # from the hex color.
Example
console.log(cutHex("#000000"))
// "000000"
Parameters:
Name Type Description
hex String hex color
Returns:
hex color
Type
String

(static) hex3to6(hex) → {String}

Source:
convert 3-digit hex color to 6-digit hex color.
Example
console.log(hex3to6("#123"));
// "#112233"
Parameters:
Name Type Description
hex String 3-digit hex color
Returns:
6-digit hex color
Type
String

(static) hexToRGB(hex) → {Array}

Source:
convert hex color to rgb color.
Example
console.log(hexToRGB("#000000"));
// [0, 0, 0]
console.log(hexToRGB("#201045"));
// [32, 16, 69]
Parameters:
Name Type Description
hex String hex color
Returns:
rgb color
Type
Array

(static) hslToRGB(hsl) → {Array}

Source:
convert hsl color to rgb color.
Example
console.log(hslToRGB([150, 0.5, 0.4]));
// [51, 153, 102]
Parameters:
Name Type Description
hsl Array hsl color(hue: 0 ~ 360, saturation: 0 ~ 1, lightness: 0 ~ 1)
Returns:
rgb color
Type
Array