Copy link to clipboard
Copied
Hello everyone,
I'm trying to write a script that changes the default fill content. It is pretty straightforward for RGBColor and CMYKColor (and NONE), but I'm finding difficulty finding a way to place a gradient or a fill by name (they exist in the swatches so a if there's a way to set a swatch to the fill can be a solution.
this worked
var doc = app.activeDocument;
var tmp = doc.pathItems.add();
tmp.setEntirePath([[0,0],[0,0]]);
tmp.filled = true;
var sw = doc.swatches.getByName(patternName);
tmp.fillColor = sw.color;
doc.defaultFilled = true;
doc.defaultFillColor = tmp.fillColor;
tmp.remove();
Copy link to clipboard
Copied
this worked
var doc = app.activeDocument;
var tmp = doc.pathItems.add();
tmp.setEntirePath([[0,0],[0,0]]);
tmp.filled = true;
var sw = doc.swatches.getByName(patternName);
tmp.fillColor = sw.color;
doc.defaultFilled = true;
doc.defaultFillColor = tmp.fillColor;
tmp.remove();
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more