Skip to main content
gregd
Inspiring
July 15, 2025
Answered

How to change default fill and stroke color?

  • July 15, 2025
  • 1 reply
  • 192 views

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!

Correct answer Peter Kahrel
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
July 15, 2025
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.