Skip to main content
gregd
Inspiring
Jul 15, 2025 7:55 PM UTC
Answered

How to change default fill and stroke color?

How do I change the default fill and stroke color for newly created shapes with a script? That is to say, the colors that are applied when I draw a shape with the shape tool, not any existing shapes. Thanks!

Peter Kahrel
Peter KahrelCorrect answer
Community Expert
Jul 15, 2025 8:04 PM UTC
app.activeDocument.pageItemDefaults.strokeColor = ...;
app.activeDocument.pageItemDefaults.fillColor = ...;

That's for the active document only. To change it for all new documents, leave out activeDocument. 

1 reply

Peter Kahrel
Community Expert
Peter KahrelCommunity ExpertCorrect answer
Community Expert
Jul 15, 2025 8:04 PM UTC
app.activeDocument.pageItemDefaults.strokeColor = ...;
app.activeDocument.pageItemDefaults.fillColor = ...;

That's for the active document only. To change it for all new documents, leave out activeDocument. 

Translate