Constructor
# new DuColor(floatRGBAopt)
Constructs a new color object
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
floatRGBA |
Array.<float>
|
<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 |
Members
Array.<DuColor>
# static readonly Color
Enum for predefined colors. float [R,G,B,A]
Properties:
Name | Type | 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_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
# 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
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 |
The color
# static fromHSL(hsl) → {DuColor}
Creates a new color from HSL(A) values
Parameters:
Name | Type | Description |
---|---|---|
hsl |
Array.<float>
|
the HSL(A) values |
the color.
# 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 |
# 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 |
The color
# 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
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
the HSLA color array
Array.<float>
# 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
true if the color is valid
boolean
# static randomFloatRGBA() → {Array.<float>}
Generates a random color
- Deprecated:
- Yes
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
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
the RGBA color array
Array.<float>
# adjusted()
Creates a color adjusted according to the brightness setting of the application.
For now, works only in After Effects
For now, works only in After Effects
The new color
# 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 |
The new color
# 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). |
true if the colors are the same.
Boolean
# 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 |
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 |
an [R,G,B,A] Array.
float
# hexA() → {string}
Returns the hexcode for this color, including the alpha (at the end)
The hex code, without the leading '#'.
string
# isValid() → {boolean}
true if [R,G,B,A] in the range 0.0 ... 1.0
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 |
The new color
# toJSON() → {string}
Creates a JSON string representation of the color; Actually an RGBA float Array.
The JSON
string