Skip to main content
Inspiring
September 5, 2022
Answered

how to change characterColor of certain paragraphStyle using indesign javascript

  • September 5, 2022
  • 1 reply
  • 415 views

Hi I am trying to change characterColor of certain paragraphStyles in indesign javascript, I checked the paragraphStyle methods but unable to find the correct method or property. Help me with this!

This topic has been closed for replies.
Correct answer Manan Joshi

I am getting this Error: Invalid request on a root style.


You can't change the sytem defined No Paragraph Style and you should not change the Basic Paragraph Style. So execute your loop from s = 2 onwards as the index 0 and 1 correspond to these two styles.

-Manan

1 reply

Community Expert
September 5, 2022

Try fillColor and strokeColor property

-Manan

-Manan
Inspiring
September 5, 2022

Hi Manan, I tried but not working for me!

var myDoc = app.activeDocument;
var paraStyles = myDoc.allParagraphStyles;
for(var s=0; s<paraStyles.length;s++){
//~ myDoc.allParagraphStyles[s].fillColor="LAD_Color";
myDoc.allParagraphStyles[s].fillColor= myDoc.swatches.itemByName("LAD_Color");
//myDoc.allParagraphStyles[s].strokeColor="LAD_Color";
}

 

Inspiring
September 5, 2022

I am getting this Error: Invalid request on a root style.