Class: DuColor

DuColor

A simple class to manage colors and convert them.

new DuColor(floatRGBA)

D:/DEV_SRC/RxOT/DuPSF/tools/output/DuPSF.jsxinc, line 5758
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/DuPSF/tools/output/DuPSF.jsxinc, line 6398
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/DuPSF/tools/output/DuPSF.jsxinc, line 6111
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/DuPSF/tools/output/DuPSF.jsxinc, line 6138
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/DuPSF/tools/output/DuPSF.jsxinc, line 6180
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/DuPSF/tools/output/DuPSF.jsxinc, line 6197
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/DuPSF/tools/output/DuPSF.jsxinc, line 6272
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/DuPSF/tools/output/DuPSF.jsxinc, line 6322
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/DuPSF/tools/output/DuPSF.jsxinc, line 6228
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/DuPSF/tools/output/DuPSF.jsxinc, line 6207
Generates a random color, with the alpha == 1.0
Returns:
Type Description
DuColor The color

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

D:/DEV_SRC/RxOT/DuPSF/tools/output/DuPSF.jsxinc, line 6253
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/DuPSF/tools/output/DuPSF.jsxinc, line 6300
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/DuPSF/tools/output/DuPSF.jsxinc, line 6362
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:/DEV_SRC/RxOT/DuPSF/tools/output/DuPSF.jsxinc, line 6015
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:/DEV_SRC/RxOT/DuPSF/tools/output/DuPSF.jsxinc, line 5955
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/DuPSF/tools/output/DuPSF.jsxinc, line 5992
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:/DEV_SRC/RxOT/DuPSF/tools/output/DuPSF.jsxinc, line 5910
Returns the HSL values
Returns:
Type Description
Array.<float> the HSL

floatHSLA(){Array.<float>}

D:/DEV_SRC/RxOT/DuPSF/tools/output/DuPSF.jsxinc, line 5943
Returns the HSLA values
Returns:
Type Description
Array.<float> the HSL

floatRGB(clamped){float}

D:/DEV_SRC/RxOT/DuPSF/tools/output/DuPSF.jsxinc, line 5823
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/DuPSF/tools/output/DuPSF.jsxinc, line 5804
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/DuPSF/tools/output/DuPSF.jsxinc, line 5878
Returns the hexcode for this color
Returns:
Type Description
string The hex code, without the leading '#'.

hexA(){string}

D:/DEV_SRC/RxOT/DuPSF/tools/output/DuPSF.jsxinc, line 5897
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/DuPSF/tools/output/DuPSF.jsxinc, line 5853
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/DuPSF/tools/output/DuPSF.jsxinc, line 5842
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/DuPSF/tools/output/DuPSF.jsxinc, line 5866
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/DuPSF/tools/output/DuPSF.jsxinc, line 5973
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:/DEV_SRC/RxOT/DuPSF/tools/output/DuPSF.jsxinc, line 6005
Creates a JSON string representation of the color; Actually an RGBA float Array.
Returns:
Type Description
string The JSON