Adobe InDesign CS2 (4.0) Object Model JS: Color

InDesign CS2

Class

Color

 

A color swatch. Base Class: Swatch

Superclass of Tint

QuickLinks

duplicate, extractLabel, getElements, insertLabel, merge, remove, toSource, toSpecifier

Hierarchy

Application | Document
Swatch
Color
Tint

Properties

PropertyTypeAccessDescription
colorValue Array of number r/wThe ink values that create the color, specified as a percentage for each ink. Note: The number of values required and the range depends on the color space. For RGB, specify three values, with each value in the range 0 to 255; for CMYK, specify four values representing C, M, Y, and K, with each value in the range 0 to 100; for LAB, specify three values representing L (Range: 0 to 100), A (Range: -128 to 127), and B (Range: -128 to 127); for mixed ink, specify values for each ink in the ink list, with each value in the range 0 to 100.
idnumber readonlyThe unique ID of the Color.
indexnumber readonlyThe index of the Color within its containing object.
labelstring r/wA property that can be set to any string.
modelColorModel:
ColorModel.SPOT
ColorModel.PROCESS
ColorModel.REGISTRATION
ColorModel.MIXEDINKMODEL
r/wThe color model.
namestring r/wThe name of the Color.
parentApplication
Document
readonlyThe parent of the Color (a Application or Document).
propertiesObject r/wA property that allows setting of several properties at the same time.
spaceColorSpace:
ColorSpace.RGB
ColorSpace.CMYK
ColorSpace.LAB
ColorSpace.MIXEDINK
r/wThe color space.

Methods

Instances

Color duplicate ()
Duplicates the Color.

string extractLabel (key: string)
Gets the label value associated with the specified key.

ParameterTypeDescription
keystringThe key.

Array of Object getElements ()
Resolves the object specifier, creating an array of object references.

void insertLabel (key: string, value: string)
Sets the label to the value associated with the specified key.

ParameterTypeDescription
keystringThe key.
valuestringThe value.

Swatch merge (with: any)
Merges the specified swatches with the swatch.

ParameterTypeDescription
with Array of Swatches
String
Swatch
The swatches to merge. Can accept: Array of Swatches, Swatch or String.

void remove ([replacingWith: Swatch])
Deletes the swatch.

ParameterTypeDescription
replacingWithSwatchThe swatch to apply in place of the deleted swatch. (Optional)

string toSource ()
Generates a string which, if executed, will return the Color.

string toSpecifier ()
Retrieves the object specifier.

Element of

GradientStop.stopColor

Tint.baseColor

Used in:

array of Color Colors.itemByRange (from: any, to: any)

Color Colors.nextItem (obj: Color)

Color Colors.previousItem (obj: Color)

Tint Tints.add ([color: Color][, withProperties: Object])

Return

Color Application.importAdobeSwatchbookProcessColor (name: string)

Color Application.importAdobeSwatchbookSpotColor (name: string)

Color Color.duplicate ()

Color Colors.add ([withProperties: Object])

Color Colors.anyItem ()

Array of Color Colors.everyItem ()

Color Colors.firstItem ()

Color Colors.item (index: any)

Color Colors.itemByID (id: number)

Color Colors.itemByName (name: string)

Array of Color Colors.itemByRange (from: any, to: any)

Color Colors.lastItem ()

Color Colors.middleItem ()

Color Colors.nextItem (obj: Color)

Color Colors.previousItem (obj: Color)

Color Document.importAdobeSwatchbookProcessColor (name: string)

Color Document.importAdobeSwatchbookSpotColor (name: string)

Jongware, 27-Jun-2010 v3.0.3dContents :: Index