Adobe InDesign CS5.5 (7.5) Object Model JS: Swatch

InDesign CS5.5

Class

Swatch

 

A swatch (color, gradient, tint, or mixed ink).

Superclass of Color, Gradient, MixedInk, and MixedInkGroup

QuickLinks

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

Hierarchy

Application | Document
Swatch
Color | Gradient | MixedInk | MixedInkGroup
Event | EventListener | MutationEvent

Properties

PropertyTypeAccessDescription
eventListenersEventListeners EventListener readonlyA collection of event listeners.
eventsEvents Event readonlyA collection of events.
idnumber readonlyThe unique ID of the Swatch.
indexnumber readonlyThe index of the Swatch within its containing object.
isValidbool readonlyReturns true if the object specifier resolves to valid objects.
labelstring r/wA property that can be set to any string.
namestring r/wThe name of the Swatch.
parentApplicationDocument readonlyThe parent of the Swatch (a Application or Document).
propertiesObject r/wA property that allows setting of several properties at the same time.

Methods

Instances

EventListener addEventListener (eventType: string, handler: varies[, captures: bool=false])
Adds an event listener.

ParameterTypeDescription
eventTypestringThe event type.
handlerFile
JavaScript Function
The event handler. Can accept: File or JavaScript Function.
capturesboolThis parameter is obsolete. (Optional) (default: false)

Swatch duplicate ()
Duplicates the Swatch.

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

ParameterTypeDescription
keystringThe key.

Array of Swatch 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: varies)
Merges the specified swatches with the swatch.

ParameterTypeDescription
withArray 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)

bool removeEventListener (eventType: string, handler: varies[, captures: bool=false])
Removes the event listener.

ParameterTypeDescription
eventTypestringThe registered event type.
handlerFile
JavaScript Function
The registered event handler. Can accept: File or JavaScript Function.
capturesboolThis parameter is obsolete. (Optional) (default: false)

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

string toSpecifier ()
Retrieves the object specifier.

Element of

Application.unusedSwatches

BevelAndEmbossSetting.highlightColor

BevelAndEmbossSetting.shadowColor

Button.fillColor

Button.gapColor

Button.strokeColor

Cell.bottomEdgeStrokeColor

Cell.bottomEdgeStrokeGapColor

Cell.diagonalLineStrokeColor

Cell.diagonalLineStrokeGapColor

Cell.fillColor

Cell.innerColumnStrokeColor

Cell.innerColumnStrokeGapColor

Cell.innerRowStrokeColor

Cell.innerRowStrokeGapColor

Cell.leftEdgeStrokeColor

Cell.leftEdgeStrokeGapColor

Cell.rightEdgeStrokeColor

Cell.rightEdgeStrokeGapColor

Cell.topEdgeStrokeColor

Cell.topEdgeStrokeGapColor

CellStyle.bottomEdgeStrokeColor

CellStyle.bottomEdgeStrokeGapColor

CellStyle.diagonalLineStrokeColor

CellStyle.diagonalLineStrokeGapColor

CellStyle.fillColor

CellStyle.leftEdgeStrokeColor

CellStyle.leftEdgeStrokeGapColor

CellStyle.rightEdgeStrokeColor

CellStyle.rightEdgeStrokeGapColor

CellStyle.topEdgeStrokeColor

CellStyle.topEdgeStrokeGapColor

ChangeGrepPreference.fillColor

ChangeGrepPreference.kentenFillColor

ChangeGrepPreference.kentenStrokeColor

ChangeGrepPreference.rubyFill

ChangeGrepPreference.rubyStroke

ChangeGrepPreference.strikeThroughColor

ChangeGrepPreference.strikeThroughGapColor

ChangeGrepPreference.strokeColor

ChangeGrepPreference.underlineColor

ChangeGrepPreference.underlineGapColor

ChangeObjectPreference.fillColor

ChangeObjectPreference.gapColor

ChangeObjectPreference.strokeColor

ChangeTextPreference.fillColor

ChangeTextPreference.kentenFillColor

ChangeTextPreference.kentenStrokeColor

ChangeTextPreference.rubyFill

ChangeTextPreference.rubyStroke

ChangeTextPreference.strikeThroughColor

ChangeTextPreference.strikeThroughGapColor

ChangeTextPreference.strokeColor

ChangeTextPreference.underlineColor

ChangeTextPreference.underlineGapColor

ChangeTransliteratePreference.fillColor

ChangeTransliteratePreference.kentenFillColor

ChangeTransliteratePreference.kentenStrokeColor

ChangeTransliteratePreference.rubyFill

ChangeTransliteratePreference.rubyStroke

ChangeTransliteratePreference.strikeThroughColor

ChangeTransliteratePreference.strikeThroughGapColor

ChangeTransliteratePreference.strokeColor

ChangeTransliteratePreference.underlineColor

ChangeTransliteratePreference.underlineGapColor

Character.fillColor

Character.kentenFillColor

Character.kentenStrokeColor

Character.rubyFill

Character.rubyStroke

Character.ruleAboveColor

Character.ruleAboveGapColor

Character.ruleBelowColor

Character.ruleBelowGapColor

Character.strikeThroughColor

Character.strikeThroughGapColor

Character.strokeColor

Character.underlineColor

Character.underlineGapColor

CharacterStyle.fillColor

CharacterStyle.kentenFillColor

CharacterStyle.kentenStrokeColor

CharacterStyle.rubyFill

CharacterStyle.rubyStroke

CharacterStyle.strikeThroughColor

CharacterStyle.strikeThroughGapColor

CharacterStyle.strokeColor

CharacterStyle.underlineColor

CharacterStyle.underlineGapColor

Column.bottomEdgeStrokeColor

Column.bottomEdgeStrokeGapColor

Column.diagonalLineStrokeColor

Column.diagonalLineStrokeGapColor

Column.fillColor

Column.innerColumnStrokeColor

Column.innerColumnStrokeGapColor

Column.innerRowStrokeColor

Column.innerRowStrokeGapColor

Column.leftEdgeStrokeColor

Column.leftEdgeStrokeGapColor

Column.rightEdgeStrokeColor

Column.rightEdgeStrokeGapColor

Column.topEdgeStrokeColor

Column.topEdgeStrokeGapColor

Document.unusedSwatches

DropShadowSetting.effectColor

EPS.fillColor

EPS.gapColor

EPS.strokeColor

EPSText.fillColor

EPSText.gapColor

EPSText.strokeColor

FindChangeBevelAndEmbossSetting.highlightColor

FindChangeBevelAndEmbossSetting.shadowColor

FindChangeDropShadowSetting.effectColor

FindChangeInnerGlowSetting.effectColor

FindChangeInnerShadowSetting.effectColor

FindChangeOuterGlowSetting.effectColor

FindChangeSatinSetting.effectColor

FindGrepPreference.fillColor

FindGrepPreference.kentenFillColor

FindGrepPreference.kentenStrokeColor

FindGrepPreference.rubyFill

FindGrepPreference.rubyStroke

FindGrepPreference.strikeThroughColor

FindGrepPreference.strikeThroughGapColor

FindGrepPreference.strokeColor

FindGrepPreference.underlineColor

FindGrepPreference.underlineGapColor

FindObjectPreference.fillColor

FindObjectPreference.gapColor

FindObjectPreference.strokeColor

FindTextPreference.fillColor

FindTextPreference.kentenFillColor

FindTextPreference.kentenStrokeColor

FindTextPreference.rubyFill

FindTextPreference.rubyStroke

FindTextPreference.strikeThroughColor

FindTextPreference.strikeThroughGapColor

FindTextPreference.strokeColor

FindTextPreference.underlineColor

FindTextPreference.underlineGapColor

FindTransliteratePreference.fillColor

FindTransliteratePreference.kentenFillColor

FindTransliteratePreference.kentenStrokeColor

FindTransliteratePreference.rubyFill

FindTransliteratePreference.rubyStroke

FindTransliteratePreference.strikeThroughColor

FindTransliteratePreference.strikeThroughGapColor

FindTransliteratePreference.strokeColor

FindTransliteratePreference.underlineColor

FindTransliteratePreference.underlineGapColor

FootnoteOption.continuingRuleColor

FootnoteOption.continuingRuleGapColor

FootnoteOption.ruleColor

FootnoteOption.ruleGapColor

FormField.fillColor

FormField.gapColor

FormField.strokeColor

Graphic.fillColor

Graphic.gapColor

Graphic.strokeColor

GraphicLine.fillColor

GraphicLine.gapColor

GraphicLine.strokeColor

Group.fillColor

Group.gapColor

Group.strokeColor

Image.fillColor

Image.gapColor

Image.strokeColor

ImportedPage.fillColor

ImportedPage.gapColor

ImportedPage.strokeColor

InnerGlowSetting.effectColor

InnerShadowSetting.effectColor

InsertionPoint.fillColor

InsertionPoint.kentenFillColor

InsertionPoint.kentenStrokeColor

InsertionPoint.rubyFill

InsertionPoint.rubyStroke

InsertionPoint.ruleAboveColor

InsertionPoint.ruleAboveGapColor

InsertionPoint.ruleBelowColor

InsertionPoint.ruleBelowGapColor

InsertionPoint.strikeThroughColor

InsertionPoint.strikeThroughGapColor

InsertionPoint.strokeColor

InsertionPoint.underlineColor

InsertionPoint.underlineGapColor

Line.fillColor

Line.kentenFillColor

Line.kentenStrokeColor

Line.rubyFill

Line.rubyStroke

Line.ruleAboveColor

Line.ruleAboveGapColor

Line.ruleBelowColor

Line.ruleBelowGapColor

Line.strikeThroughColor

Line.strikeThroughGapColor

Line.strokeColor

Line.underlineColor

Line.underlineGapColor

MediaItem.fillColor

MediaItem.gapColor

MediaItem.strokeColor

Movie.fillColor

Movie.gapColor

Movie.strokeColor

MultiStateObject.fillColor

MultiStateObject.gapColor

MultiStateObject.strokeColor

ObjectStyle.fillColor

ObjectStyle.gapColor

ObjectStyle.strokeColor

OuterGlowSetting.effectColor

Oval.fillColor

Oval.gapColor

Oval.strokeColor

PDF.fillColor

PDF.gapColor

PDF.strokeColor

PICT.fillColor

PICT.gapColor

PICT.strokeColor

PageItem.fillColor

PageItem.gapColor

PageItem.strokeColor

PageItemDefault.fillColor

PageItemDefault.gapColor

PageItemDefault.strokeColor

Paragraph.fillColor

Paragraph.kentenFillColor

Paragraph.kentenStrokeColor

Paragraph.rubyFill

Paragraph.rubyStroke

Paragraph.ruleAboveColor

Paragraph.ruleAboveGapColor

Paragraph.ruleBelowColor

Paragraph.ruleBelowGapColor

Paragraph.strikeThroughColor

Paragraph.strikeThroughGapColor

Paragraph.strokeColor

Paragraph.underlineColor

Paragraph.underlineGapColor

ParagraphStyle.fillColor

ParagraphStyle.kentenFillColor

ParagraphStyle.kentenStrokeColor

ParagraphStyle.rubyFill

ParagraphStyle.rubyStroke

ParagraphStyle.ruleAboveColor

ParagraphStyle.ruleAboveGapColor

ParagraphStyle.ruleBelowColor

ParagraphStyle.ruleBelowGapColor

ParagraphStyle.strikeThroughColor

ParagraphStyle.strikeThroughGapColor

ParagraphStyle.strokeColor

ParagraphStyle.underlineColor

ParagraphStyle.underlineGapColor

Polygon.fillColor

Polygon.gapColor

Polygon.strokeColor

Rectangle.fillColor

Rectangle.gapColor

Rectangle.strokeColor

Row.bottomEdgeStrokeColor

Row.bottomEdgeStrokeGapColor

Row.diagonalLineStrokeColor

Row.diagonalLineStrokeGapColor

Row.fillColor

Row.innerColumnStrokeColor

Row.innerColumnStrokeGapColor

Row.innerRowStrokeColor

Row.innerRowStrokeGapColor

Row.leftEdgeStrokeColor

Row.leftEdgeStrokeGapColor

Row.rightEdgeStrokeColor

Row.rightEdgeStrokeGapColor

Row.topEdgeStrokeColor

Row.topEdgeStrokeGapColor

SatinSetting.effectColor

Sound.fillColor

Sound.gapColor

Sound.strokeColor

SplineItem.fillColor

SplineItem.gapColor

SplineItem.strokeColor

Story.fillColor

Story.kentenFillColor

Story.kentenStrokeColor

Story.rubyFill

Story.rubyStroke

Story.ruleAboveColor

Story.ruleAboveGapColor

Story.ruleBelowColor

Story.ruleBelowGapColor

Story.strikeThroughColor

Story.strikeThroughGapColor

Story.strokeColor

Story.underlineColor

Story.underlineGapColor

StrokeFillProxySetting.fillColor

StrokeFillProxySetting.strokeColor

Table.bottomBorderStrokeColor

Table.bottomBorderStrokeGapColor

Table.endColumnFillColor

Table.endColumnStrokeColor

Table.endColumnStrokeGapColor

Table.endRowFillColor

Table.endRowStrokeColor

Table.endRowStrokeGapColor

Table.leftBorderStrokeColor

Table.leftBorderStrokeGapColor

Table.rightBorderStrokeColor

Table.rightBorderStrokeGapColor

Table.startColumnFillColor

Table.startColumnStrokeColor

Table.startColumnStrokeGapColor

Table.startRowFillColor

Table.startRowStrokeColor

Table.startRowStrokeGapColor

Table.topBorderStrokeColor

Table.topBorderStrokeGapColor

TableStyle.bottomBorderStrokeColor

TableStyle.bottomBorderStrokeGapColor

TableStyle.endColumnFillColor

TableStyle.endColumnStrokeColor

TableStyle.endColumnStrokeGapColor

TableStyle.endRowFillColor

TableStyle.endRowStrokeColor

TableStyle.endRowStrokeGapColor

TableStyle.leftBorderStrokeColor

TableStyle.leftBorderStrokeGapColor

TableStyle.rightBorderStrokeColor

TableStyle.rightBorderStrokeGapColor

TableStyle.startColumnFillColor

TableStyle.startColumnStrokeColor

TableStyle.startColumnStrokeGapColor

TableStyle.startRowFillColor

TableStyle.startRowStrokeColor

TableStyle.startRowStrokeGapColor

TableStyle.topBorderStrokeColor

TableStyle.topBorderStrokeGapColor

Text.fillColor

Text.kentenFillColor

Text.kentenStrokeColor

Text.rubyFill

Text.rubyStroke

Text.ruleAboveColor

Text.ruleAboveGapColor

Text.ruleBelowColor

Text.ruleBelowGapColor

Text.strikeThroughColor

Text.strikeThroughGapColor

Text.strokeColor

Text.underlineColor

Text.underlineGapColor

TextColumn.fillColor

TextColumn.kentenFillColor

TextColumn.kentenStrokeColor

TextColumn.rubyFill

TextColumn.rubyStroke

TextColumn.ruleAboveColor

TextColumn.ruleAboveGapColor

TextColumn.ruleBelowColor

TextColumn.ruleBelowGapColor

TextColumn.strikeThroughColor

TextColumn.strikeThroughGapColor

TextColumn.strokeColor

TextColumn.underlineColor

TextColumn.underlineGapColor

TextDefault.fillColor

TextDefault.kentenFillColor

TextDefault.kentenStrokeColor

TextDefault.rubyFill

TextDefault.rubyStroke

TextDefault.ruleAboveColor

TextDefault.ruleAboveGapColor

TextDefault.ruleBelowColor

TextDefault.ruleBelowGapColor

TextDefault.strikeThroughColor

TextDefault.strikeThroughGapColor

TextDefault.strokeColor

TextDefault.underlineColor

TextDefault.underlineGapColor

TextFrame.fillColor

TextFrame.gapColor

TextFrame.strokeColor

TextStyleRange.fillColor

TextStyleRange.kentenFillColor

TextStyleRange.kentenStrokeColor

TextStyleRange.rubyFill

TextStyleRange.rubyStroke

TextStyleRange.ruleAboveColor

TextStyleRange.ruleAboveGapColor

TextStyleRange.ruleBelowColor

TextStyleRange.ruleBelowGapColor

TextStyleRange.strikeThroughColor

TextStyleRange.strikeThroughGapColor

TextStyleRange.strokeColor

TextStyleRange.underlineColor

TextStyleRange.underlineGapColor

WMF.fillColor

WMF.gapColor

WMF.strokeColor

Word.fillColor

Word.kentenFillColor

Word.kentenStrokeColor

Word.rubyFill

Word.rubyStroke

Word.ruleAboveColor

Word.ruleAboveGapColor

Word.ruleBelowColor

Word.ruleBelowGapColor

Word.strikeThroughColor

Word.strikeThroughGapColor

Word.strokeColor

Word.underlineColor

Word.underlineGapColor

XmlStory.fillColor

XmlStory.kentenFillColor

XmlStory.kentenStrokeColor

XmlStory.rubyFill

XmlStory.rubyStroke

XmlStory.ruleAboveColor

XmlStory.ruleAboveGapColor

XmlStory.ruleBelowColor

XmlStory.ruleBelowGapColor

XmlStory.strikeThroughColor

XmlStory.strikeThroughGapColor

XmlStory.strokeColor

XmlStory.underlineColor

XmlStory.underlineGapColor

Used in:

void Application.saveSwatches (to: File, swatchList: Array of Swatch[, versionComments: string][, forceSave: bool=false])

void Color.remove ([replacingWith: Swatch])

void Document.saveSwatches (to: File, swatchList: Array of Swatch[, versionComments: string][, forceSave: bool=false])

void Gradient.remove ([replacingWith: Swatch])

void MixedInk.remove ([replacingWith: Swatch])

void MixedInkGroup.remove ([replacingWith: Swatch])

void Swatch.remove ([replacingWith: Swatch])

Swatch Swatches.nextItem (obj: Swatch)

Swatch Swatches.previousItem (obj: Swatch)

void Tint.remove ([replacingWith: Swatch])

Return

Swatch Color.merge (with: varies)

Swatch Gradient.merge (with: varies)

Swatch MixedInk.merge (with: varies)

Swatch MixedInkGroup.merge (with: varies)

Swatch Swatch.duplicate ()

Array of Swatch Swatch.getElements ()

Swatch Swatch.merge (with: varies)

Swatch Swatches.[] (index: number)

Swatch Swatches.anyItem ()

Array of Swatch Swatches.everyItem ()

Swatch Swatches.firstItem ()

Swatch Swatches.item (index: varies)

Swatch Swatches.itemByID (id: number)

Swatch Swatches.itemByName (name: string)

Array of Swatch Swatches.itemByRange (from: varies, to: varies)

Swatch Swatches.lastItem ()

Swatch Swatches.middleItem ()

Swatch Swatches.nextItem (obj: Swatch)

Swatch Swatches.previousItem (obj: Swatch)

Swatch Tint.merge (with: varies)

Jongware, 28-Apr-2012 v3.0.3iContents :: Index