Copy link to clipboard
Copied
I managed to figure how to change the location using:
app.activeDocument.gradients[0].gradientStops[0].location = 50;
but I'm lost when it comes to changing its color.
Copy link to clipboard
Copied
You access the first one through app.activeDocument.gradients[0].gradientStops[0].stopColor;
It will return either a Color or MixedInk. From there, you can change the color profile. Ie:
var firstStop = app.activeDocument.gradients[0].gradientStops[0].stopColor;
firstStop.space = ColorSpace.RGB;
firstStop.colorValue = [100, 20, 10];
Or you can assign it to a preexisting swatch, color, etc:
app.activeDocument.gradients[0].gradientStops[0].stopColor = app.activeDocument.swatches.itemByName("PredefinedSwatch");