color
Colors are represented by arrays where the first element is the colorspace and the remaining elements are the values of each color component. Each value is a number between 0 and 1.
For example ["RGB", 0, 1, 0 ]
represents the color blue. Invalid arrays are interpreted as black.
Colorspace | String | Components |
---|---|---|
Transparent | "T" | 0 |
Gray | "G" | 1 |
RGB | "RGB" | 3 |
CMYK | "CMYK" | 4 |
properties
Property | Equivalent Array |
---|---|
transparent | [ "T" ] |
black | [ "G", 0 ] |
white | [ "G", 1 ] |
red | [ "RGB", 1, 0, 0 ] |
green | [ "RGB", 0, 1, 0 ] |
blue | [ "RGB", 0, 0, 1 ] |
cyan | [ "CMYK", 1, 0, 0, 0 ] |
magenta | [ "CMYK", 0, 1, 0, 0 ] |
yellow | [ "CMYK", 0, 0, 1, 0 ] |
dkGray | [ "G", 0.25 ] |
gray | [ "G", 0.5 ] |
ltGray | [ "G", 0.75 ] |
example:
this.getfield("textBox").textColor = color.red
methods
convert
Secure |
---|
No |
Converts a color between colorspaces.
color.convert(array, cColorSpace)
array: Color array (see above)
cColorSpace: Target colorspace
Returns color array in the target colorspace.
example:
var cmykGreen = color.convert(color.green, "CMYK")
console.println(cmykGreen) // Displays CMYK,1,0,1,0
equal
Secure |
---|
No |
Compares color arrays, even across colorspaces.
color.equal(array1, array2)
array1: First color array
array2: Second color array
Returns boolean indicating whether or not the colors are equivalent.
example:
var result = color.equal(color.blue, ["RGB", 0, 0, 1]);
console.println(result) // Displays true