Hi
I’m making a plug-in that adds gradient overlay of layer effects.
The part that sets the color of the colorstop of the gradient overlay is the most important, but this is the problem.
Running this code adds a 45-degree black-white gradient overlay effect, but the color of each stop point doesn’t change.
I want the foreground color to be the color of colorstop1 and the background color to be the colorstop2, can you see what the problem is?
document.getElementById('gradientFillButton').addEventListener('click', async function () {
alert('clicked');
const batchPlay = require("photoshop").action.batchPlay;
const ExecuteAsModal = require("photoshop").core.executeAsModal;
ExecuteAsModal(async () => {
return batchPlay(
[
{
_obj: "set",
_target: [
{ _property: "blendOptions", _ref: "property" },
{ _enum: "ordinal", _ref: "layer", _value: "targetEnum" },
],
to: {
_obj: "blendOptions",
gradientFillMulti: [
{
_obj: "gradientFill",
angle: {
_unit: "angleUnit",
_value: 45,
},
type: { _enum: "gradientType", _value: "linear" },
stops: [
{
color: {
mode: "RGBColor",
value: {
"r": 102.0,
"g": 238.0,
"b": 207.0
},
"type": "process",
},
midpoint: 50,
offset: 0,
},
{
color: {
mode: "RGBColor",
value: {
"r": 74.0,
"g": 67.0,
"b": 207.0
},
"type": "process",
},
midpoint: 50,
offset: 1.0,
}
]
},
],
},
},
],
{ options: { dialogOptions: "display" } }
);
});
});