Class: DuColor

DuColor

A simple class to manage colors and convert them.

new DuColor(floatRGBA)

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 6417
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_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:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 7058
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:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 6771
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:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 6798
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:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 6840
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:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 6857
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:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 6932
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:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 6982
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:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 6888
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:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 6867
Generates a random color, with the alpha == 1.0
Returns:
Type Description
DuColor The color

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

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 6913
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:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 6960
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:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 7022
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

adjusted()

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 6674
Creates a color adjusted according to the brightness setting of the application.
For now, works only in After Effects
Returns:
The new color

darker(ratio){DuColor}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 6614
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:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 6651
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.

floatHSL(){Array.<float>}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 6569
Returns the HSL values
Returns:
Type Description
Array.<float> the HSL

floatHSLA(){Array.<float>}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 6602
Returns the HSLA values
Returns:
Type Description
Array.<float> the HSL

floatRGB(clamped){float}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 6482
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:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 6463
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:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 6537
Returns the hexcode for this color
Returns:
Type Description
string The hex code, without the leading '#'.

hexA(){string}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 6556
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:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 6512
Returns the color as an 8-bit int Array without alpha
Returns:
Type Description
int an [R,G,B] Array.

intRGBA(){int}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 6501
Returns the color as an 8-bit int Array with alpha
Returns:
Type Description
int an [R,G,B,A] Array.

isValid(){boolean}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 6525
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:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 6632
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

toJSON(){string}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 6664
Creates a JSON string representation of the color; Actually an RGBA float Array.
Returns:
Type Description
string The JSON