Class

DuColor

DuColor(floatRGBAopt)

A simple class to manage colors and convert them.
Constructor

# new DuColor(floatRGBAopt)

Constructs a new color object
Parameters:
Name Type Attributes Default Description
floatRGBA Array.<Number> <optional>
[0,0,0,1] 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

View Source DuAEF.jsxinc, line 2275

Members

DuColor

# static readonly Color

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

View Source DuAEF.jsxinc, line 2586

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)
Deprecated:
  • Yes

View Source DuAEF.jsxinc, line 2996

the RGBA color array
Array.<float>

# static fromHex(hexColor) → {DuColor}

Creates a new DuColor from a hex code/array
Parameters:
Name Type Description
hexColor string | Array.<int> The hexadecimal color

View Source DuAEF.jsxinc, line 2709

The color
DuColor

# static fromHSL(hsl) → {DuColor}

Creates a new color from HSL(A) values
Parameters:
Name Type Description
hsl Array.<float> the HSL(A) values

View Source DuAEF.jsxinc, line 2736

the color.
DuColor

# static fromInt(source) → {DuColor}

Creates a new color from an 8-bit int RGB(A) array
Parameters:
Name Type Description
source Array.<int> The 8-bit int RGB(A) array

View Source DuAEF.jsxinc, line 2778

DuColor

# static fromJSON(json) → {DuColor}

Creates a color from a JSON string; Actually a JSON RGBA float Array.
Parameters:
Name Type Description
json string The JSON string

View Source DuAEF.jsxinc, line 2795

The color
DuColor

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

Converts an hexadecimal color to a floatRGBA 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
Deprecated:
  • Yes

View Source DuAEF.jsxinc, line 2870

The color as an [R,G,B,A] Array with float values between 0.0 and 1.0
Array.<float>

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

Converts an HSL color to RGB
Parameters:
Name Type Description
color Array.<float> The RGBA color array
Deprecated:
  • Yes

View Source DuAEF.jsxinc, line 2920

the HSLA color array
Array.<float>

# static isUsingDarkMode()

Checks if the app is in "dark mode", i.e. the APP_TEXT_COLOR is lighter than the APP_BACKGROUND_COLOR

View Source DuAEF.jsxinc, line 2698

# static isValid(color, ignoreAlphaopt) → {boolean}

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

View Source DuAEF.jsxinc, line 2826

true if the color is valid
boolean

# static random() → {DuColor}

Generates a random color, with the alpha == 1.0

View Source DuAEF.jsxinc, line 2805

The color
DuColor

# static randomFloatRGBA() → {Array.<float>}

Generates a random color
Deprecated:
  • Yes

View Source DuAEF.jsxinc, line 2851

The color as an [R,G,B,A] Array with float values between 0.0 and 1.0
Array.<float>

# static rgbToHex(rgbColor) → {string}

Converts an RGB color to a hex string
Parameters:
Name Type Description
rgbColor Array.<float> The rgb color
Deprecated:
  • Yes

View Source DuAEF.jsxinc, line 2898

The color as an hex string
string

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

Converts an RGB color to HSL
Parameters:
Name Type Description
color Array.<float> The HSLA color array
Deprecated:
  • Yes

View Source DuAEF.jsxinc, line 2960

the RGBA color array
Array.<float>

# adjusted() → {DuColor}

Creates a color adjusted according to the brightness setting of the application.

View Source DuAEF.jsxinc, line 2566

The new color
DuColor

# darker(ratioopt) → {DuColor}

Creates a new color darker than the current one
Parameters:
Name Type Attributes Default Description
ratio int <optional>
200 A percentage: 200 means twice darker, 50 twice lighter

View Source DuAEF.jsxinc, line 2473

The new color
DuColor

# equals(ignoreAlphaopt, precisionopt) → {Boolean}

Compares two colors
Parameters:
Name Type Attributes Default Description
ignoreAlpha Boolean <optional>
false Set to true to consider colors to be equal if they differ only by their alpha.
precision int <optional>
4 The precision to use (the number of decimals to compare).

View Source DuAEF.jsxinc, line 2544

true if the colors are the same.
Boolean

# floatHSL() → {Array.<float>}

Returns the HSL values

View Source DuAEF.jsxinc, line 2428

the HSL
Array.<float>

# floatHSLA() → {Array.<float>}

Returns the HSLA values

View Source DuAEF.jsxinc, line 2461

the HSL
Array.<float>

# floatRGB(clampedopt) → {float}

Returns the color as a float Array without alpha
Parameters:
Name Type Attributes Default Description
clamped bool <optional>
true Set to false to keep the values > 1.0

View Source DuAEF.jsxinc, line 2341

an [R,G,B] Array.
float

# floatRGBA(clampedopt) → {float}

Returns the color as a float Array with alpha
Parameters:
Name Type Attributes Default Description
clamped bool <optional>
true Set to false to keep the values > 1.0

View Source DuAEF.jsxinc, line 2322

an [R,G,B,A] Array.
float

# hex() → {string}

Returns the hexcode for this color

View Source DuAEF.jsxinc, line 2396

The hex code, without the leading '#'.
string

# hexA() → {string}

Returns the hexcode for this color, including the alpha (at the end)

View Source DuAEF.jsxinc, line 2415

The hex code, without the leading '#'.
string

# intRGB() → {int}

Returns the color as an 8-bit int Array without alpha

View Source DuAEF.jsxinc, line 2371

an [R,G,B] Array.
int

# intRGBA() → {int}

Returns the color as an 8-bit int Array with alpha

View Source DuAEF.jsxinc, line 2360

an [R,G,B,A] Array.
int

# isValid() → {boolean}

true if [R,G,B,A] in the range 0.0 ... 1.0

View Source DuAEF.jsxinc, line 2384

true if the color is valid
boolean

# lighter(ratioopt) → {DuColor}

Creates a new color lighter than the current one
Parameters:
Name Type Attributes Default Description
ratio int <optional>
200 A percentage: 200 means twice lighter, 50 twice darker

View Source DuAEF.jsxinc, line 2491

The new color
DuColor

# pull(ratioopt) → {DuColor}

Creates a new color lighter or darker depending on the difference between the APP_TEXT_COLOR (foreground color) and the APP_BACKGROUND_COLOR
Parameters:
Name Type Attributes Default Description
ratio int <optional>
200 Pull ratio

View Source DuAEF.jsxinc, line 2509

The new color
DuColor

# push(ratioopt) → {DuColor}

Creates a new color lighter or darker depending on the difference between the APP_TEXT_COLOR (foreground color) and the APP_BACKGROUND_COLOR
Parameters:
Name Type Attributes Default Description
ratio int <optional>
200 Push ratio

View Source DuAEF.jsxinc, line 2526

The new color
DuColor

# toJSON() → {string}

Creates a JSON string representation of the color; Actually an RGBA float Array.

View Source DuAEF.jsxinc, line 2557

The JSON
string