Skip to content

Gradients

app.activeDocument.gradients

A collection of Gradient objects in a document.


app.activeDocument.gradients.length

The number of objects in the collection.

Number; read-only.


app.activeDocument.gradients.parent

The parent of this object.

Object; read-only.


app.activeDocument.gradients.typename

The class name of the referenced object.

String; read-only.


app.activeDocument.gradients.add()

Creates a new Gradient object.

Gradient


app.activeDocument.gradients.getByName(name)

Gets the first element in the collection with the specified name.

ParameterTypeDescription
nameStringName of element to get

Gradient


app.activeDocument.gradients.index(itemKey)

Gets an element from the collection.

ParameterTypeDescription
itemKeyString, NumberString or number key

Gradient


app.activeDocument.gradients.removeAll()

Deletes all elements in this collection.

Nothing.


// Deletes the first gradient from the current document
if (app.documents.length > 0) {
app.activeDocument.gradients[0].remove();
}