Class: DuColor

DuColor

A simple class to manage colors and convert them.

new DuColor(floatRGBA)

D:/DEV_SRC/RxOT/DuAEF/DuESF/tools/build/output/DuESF.jsxinc, line 5241
Constructs a new color object
Name Type Default Description
floatRGBA Array.<float> [0,0,0,1] optional An [R,G,B,A] float Array.
Negative values are clamped to 0.
Alpha > 1 is clamped to 1.
Colors are stored in 32 bit float to keep the maximum precision.
Properties:
Name Type Description
red float The red value
green float The green value
blue float The blue value
alpha float The alpha value

Members

static,readonlyDuColor.ColorArray.<DuColor>

Enum for predefined colors. float [R,G,B,A]
Properties:
Name Type Default Description
TRANSPARENT Array.<DuColor>
BLACK Array.<DuColor>
WHITE Array.<DuColor>
OBSIDIAN Array.<DuColor>
ABYSS_GREY Array.<DuColor>
VERY_DARK_GREY Array.<DuColor>
DARK_GREY Array.<DuColor>
LIGHT_GREY Array.<DuColor>
VERY_LIGHT_GREY Array.<DuColor>
RAINBOX_RED Array.<DuColor>
ORANGE Array.<DuColor>
YELLOW Array.<DuColor>
GREEN Array.<DuColor>
LIGHT_BLUE Array.<DuColor>
LIGHT_PURPLE Array.<DuColor>
AE_DARK_GREY Array.<DuColor>
AFTER_EFFECTS_BLUE Array.<DuColor>
RX_PURPLE Array.<DuColor>
APP_BACKGROUND_COLOR Array.<DuColor>
APP_HIGHLIGHT_COLOR Array.<DuColor>
APP_TEXT_COLOR Array.<DuColor>
AE_ORANGE Array.<DuColor>

Methods

staticDuColor.eightBpcToFloat(color){Array.<float>}

D:/DEV_SRC/RxOT/DuAEF/DuESF/tools/build/output/DuESF.jsxinc, line 5849
Converts an 8bpc color array to a 32bpc float color array
Name Type Description
color Array.<int> The RGB(A) color array in 8bpc (0-255 range)
Deprecated
  • Yes
Returns:
Type Description
Array.<float> the RGBA color array

staticDuColor.fromHex(hexColor){DuColor}

D:/DEV_SRC/RxOT/DuAEF/DuESF/tools/build/output/DuESF.jsxinc, line 5562
Creates a new DuColor from a hex code/array
Name Type Description
hexColor string | Array.<int> The hexadecimal color
Returns:
Type Description
DuColor The color

staticDuColor.fromHSL(hsl){DuColor}

D:/DEV_SRC/RxOT/DuAEF/DuESF/tools/build/output/DuESF.jsxinc, line 5589
Creates a new color from HSL(A) values
Name Type Description
hsl Array.<float> the HSL(A) values
Returns:
Type Description
DuColor the color.

staticDuColor.fromInt(source){DuColor}

D:/DEV_SRC/RxOT/DuAEF/DuESF/tools/build/output/DuESF.jsxinc, line 5631
Creates a new color from an 8-bit int RGB(A) array
Name Type Description
source Array.<int> The 8-bit int RGB(A) array
Returns:
Type Description
DuColor

staticDuColor.fromJSON(json){DuColor}

D:/DEV_SRC/RxOT/DuAEF/DuESF/tools/build/output/DuESF.jsxinc, line 5648
Creates a color from a JSON string; Actually a JSON RGBA float Array.
Name Type Description
json string The JSON string
Returns:
Type Description
DuColor The color

staticDuColor.hexToRGB(hexColor, isString){Array.<float>}

D:/DEV_SRC/RxOT/DuAEF/DuESF/tools/build/output/DuESF.jsxinc, line 5723
Converts an hexadecimal color to a floatRGBA Array
Name Type Default Description
hexColor string | Array.<int> The hexadecimal color
isString boolean true optional Whether hexColor is a string or an Array of int of base 16
Deprecated
  • Yes
Returns:
Type Description
Array.<float> The color as an [R,G,B,A] Array with float values between 0.0 and 1.0

staticDuColor.hslToRgb(color){Array.<float>}

D:/DEV_SRC/RxOT/DuAEF/DuESF/tools/build/output/DuESF.jsxinc, line 5773
Converts an HSL color to RGB
Name Type Description
color Array.<float> The RGBA color array
Deprecated
  • Yes
Returns:
Type Description
Array.<float> the HSLA color array

staticDuColor.isValid(color, ignoreAlpha){boolean}

D:/DEV_SRC/RxOT/DuAEF/DuESF/tools/build/output/DuESF.jsxinc, line 5679
Checks if this color is valid ([R,G,B,A] in the range 0.0 ... 1.0)
Name Type Default Description
color Array.<float> The floatRGBA color to validate
ignoreAlpha boolean false optional Will return true even if the array does not have any alpha value
Deprecated
  • Yes
Returns:
Type Description
boolean true if the color is valid

staticDuColor.random(){DuColor}

D:/DEV_SRC/RxOT/DuAEF/DuESF/tools/build/output/DuESF.jsxinc, line 5658
Generates a random color, with the alpha == 1.0
Returns:
Type Description
DuColor The color

staticDuColor.randomFloatRGBA(){Array.<float>}

D:/DEV_SRC/RxOT/DuAEF/DuESF/tools/build/output/DuESF.jsxinc, line 5704
Generates a random color
Deprecated
  • Yes
Returns:
Type Description
Array.<float> The color as an [R,G,B,A] Array with float values between 0.0 and 1.0

staticDuColor.rgbToHex(rgbColor){string}

D:/DEV_SRC/RxOT/DuAEF/DuESF/tools/build/output/DuESF.jsxinc, line 5751
Converts an RGB color to a hex string
Name Type Description
rgbColor Array.<float> The rgb color
Deprecated
  • Yes
Returns:
Type Description
string The color as an hex string

staticDuColor.rgbToHsl(color){Array.<float>}

D:/DEV_SRC/RxOT/DuAEF/DuESF/tools/build/output/DuESF.jsxinc, line 5813
Converts an RGB color to HSL
Name Type Description
color Array.<float> The HSLA color array
Deprecated
  • Yes
Returns:
Type Description
Array.<float> the RGBA color array

darker(ratio){DuColor}

D:/DEV_SRC/RxOT/DuAEF/DuESF/tools/build/output/DuESF.jsxinc, line 5436
Creates a new color darker than the current one
Name Type Default Description
ratio int 200 optional A percentage: 200 means twice darker, 50 twice lighter
Returns:
Type Description
DuColor The new color

equals(ignoreAlpha, precision){Boolean}

D:/DEV_SRC/RxOT/DuAEF/DuESF/tools/build/output/DuESF.jsxinc, line 5473
Compares two colors
Name Type Default Description
ignoreAlpha Boolean false optional Set to true to consider colors to be equal if they differ only by their alpha.
precision int 4 optional The precision to use (the number of decimals to compare).
Returns:
Type Description
Boolean true if the colors are the same.

floatRGB(clamped){float}

D:/DEV_SRC/RxOT/DuAEF/DuESF/tools/build/output/DuESF.jsxinc, line 5304
Returns the color as a float Array without alpha
Name Type Default Description
clamped bool true optional Set to false to keep the values > 1.0
Returns:
Type Description
float an [R,G,B] Array.

floatRGBA(clamped){float}

D:/DEV_SRC/RxOT/DuAEF/DuESF/tools/build/output/DuESF.jsxinc, line 5285
Returns the color as a float Array with alpha
Name Type Default Description
clamped bool true optional Set to false to keep the values > 1.0
Returns:
Type Description
float an [R,G,B,A] Array.

hex(){string}

D:/DEV_SRC/RxOT/DuAEF/DuESF/tools/build/output/DuESF.jsxinc, line 5359
Returns the hexcode for this color
Returns:
Type Description
string The hex code, without the leading '#'.

hexA(){string}

D:/DEV_SRC/RxOT/DuAEF/DuESF/tools/build/output/DuESF.jsxinc, line 5378
Returns the hexcode for this color, including the alpha (at the end)
Returns:
Type Description
string The hex code, without the leading '#'.

intRGB(){int}

D:/DEV_SRC/RxOT/DuAEF/DuESF/tools/build/output/DuESF.jsxinc, line 5334
Returns the color as an 8-bit int Array without alpha
Returns:
Type Description
int an [R,G,B] Array.

intRGBA(){int}

D:/DEV_SRC/RxOT/DuAEF/DuESF/tools/build/output/DuESF.jsxinc, line 5323
Returns the color as an 8-bit int Array with alpha
Returns:
Type Description
int an [R,G,B,A] Array.

isValid(){boolean}

D:/DEV_SRC/RxOT/DuAEF/DuESF/tools/build/output/DuESF.jsxinc, line 5347
true if [R,G,B,A] in the range 0.0 ... 1.0
Returns:
Type Description
boolean true if the color is valid

lighter(ratio){DuColor}

D:/DEV_SRC/RxOT/DuAEF/DuESF/tools/build/output/DuESF.jsxinc, line 5454
Creates a new color lighter than the current one
Name Type Default Description
ratio int 200 optional A percentage: 200 means twice lighter, 50 twice darker
Returns:
Type Description
DuColor The new color

toFloatHSL(){Array.<float>}

D:/DEV_SRC/RxOT/DuAEF/DuESF/tools/build/output/DuESF.jsxinc, line 5391
Returns the HSL values
Returns:
Type Description
Array.<float> the HSL

toFloatHSLA(){Array.<float>}

D:/DEV_SRC/RxOT/DuAEF/DuESF/tools/build/output/DuESF.jsxinc, line 5424
Returns the HSLA values
Returns:
Type Description
Array.<float> the HSL

toJSON(){string}

D:/DEV_SRC/RxOT/DuAEF/DuESF/tools/build/output/DuESF.jsxinc, line 5486
Creates a JSON string representation of the color; Actually an RGBA float Array.
Returns:
Type Description
string The JSON