DuAEF.DuJS.Color

Color related methods

Members

static, readonly Colors :Array.<float>

Enum for predefined colors.
Properties:
Name Type Description
BLACK Array.<float>
VERY_DARK_GREY Array.<float>
DARK_GREY Array.<float>
LIGHT_GREY Array.<float>
VERY_LIGHT_GREY Array.<float>
RAINBOX_RED Array.<float>
ORANGE Array.<float>
YELLOW Array.<float>
GREEN Array.<float>
LIGHT_BLUE Array.<float>
LIGHT_PURPLE Array.<float>
AFTER_EFFECTS_BLUE Array.<float>
RAINBOX_PURPLE Array.<float>
RANDOM Array.<float>

Methods

static eightBpcToFloat(color) → {Array.<float>}

Converts an 8bpc color array to a 32bpc float color array
Parameters:
Name Type Description
color Array.<int> The RGB(A) color array in 8bpc (0-255 range)
Returns:
Array.<float> - the RGBA color array

static hexToRGB(hexColor, isStringopt) → {Array.<float>}

Converts an hexadecimal color to an RVB Array
Parameters:
Name Type Attributes Default Description
hexColor string | Array.<int> The hexadecimal color
isString boolean <optional>
true Whether hexColor is a string or an Array of int of base 16
Returns:
Array.<float> - The color as an [R,G,B,A] Array with float values between 0.0 and 1.0

static hslToRgb(color) → {Array.<float>}

Converts an HSL color to RGB
Parameters:
Name Type Description
color Array.<float> The RGBA color array
Returns:
Array.<float> - the HSLA color array

static random() → {Array.<float>}

Generates a random color
Returns:
Array.<float> - The color as an [R,G,B,A] Array with float values between 0.0 and 1.0

static rgbToHex(rgbColor) → {string}

Converts an RGB color to a hex string
Parameters:
Name Type Description
rgbColor Array.<float> The rgb color
Returns:
string - The color as an hex string

static rgbToHsl(color) → {Array.<float>}

Converts an RGB color to HSL
Parameters:
Name Type Description
color Array.<float> The HSLA color array
Returns:
Array.<float> - the RGBA color array

static validateColor(color, ignoreAlphaopt) → {boolean}

Checks if this color is valid ([R,V,B,A] in the range 0.0 ... 1.0)
Parameters:
Name Type Attributes Default Description
color Array.<float> The color to validate
ignoreAlpha boolean <optional>
false Will return true even if the array does not have any alpha value
Returns:
boolean - true if the color is valid