Skip to content

GradientColor

gradientColor

A gradient color specification in a Gradient object. A script can create a new gradient color using a reference to an existing gradient in the document. If no existing gradient object is referenced, a default gradient is supplied.


gradientColor.angle

The gradient vector angle in degrees.

Default: 0.0.

Setting the angle does not work. Apparently this is a bug since 2008 that still exists in (at least) 29.3.1.

Number (double).


gradientColor.gradient

Reference to the object defining the gradient.

Gradient


gradientColor.hiliteAngle

The gradient highlight vector angle in degrees.

Number (double).


gradientColor.hiliteLength

The gradient highlight vector length.

Number (double).


gradientColor.length

The gradient vector length.

Number (double).


gradientColor.matrix

An additional transformation matrix to manipulate the gradient path.

Matrix.


gradientColor.origin

The gradient vector origin, the center point of the gradient in this color.

Array of 2 numbers.


gradientColor.typename

The class name of the referenced object.

String; read-only.


// Creates a new RGB document, then changes the color of the first gradient stop of an indexed gradient
app.documents.add(DocumentColorSpace.RGB);
// Get a reference to the gradient that you want to change
var gradientRef = app.activeDocument.gradients[1];
// Create the new color
var startColor = new RGBColor();
startColor.red = 255;
startColor.green = 238;
startColor.blue = 98;
// apply new color to the first gradient stop
gradientRef.gradientStops[0].color = startColor;