Skip to main content
Inspiring
Sep 5, 2022 1:42 PM UTC
Answered

how to change characterColor of certain paragraphStyle using indesign javascript

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 is closed to new replies. Start a new post to keep the conversation going.
Manan JoshiCorrect answer
Community Expert
Sep 5, 2022 2:51 PM UTC

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

-Manan

5 replies

Community Expert
Sep 5, 2022 1:52 PM UTC

Try fillColor and strokeColor property

-Manan

Translate
-Manan
Inspiring
Sep 5, 2022 2:43 PM UTC

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";
}

 

Translate
Inspiring
Sep 5, 2022 2:45 PM UTC

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

Translate