Skip to main content
dbDavideBoscolo
Legend
August 23, 2022
Answered

Change text color by scripting

  • August 23, 2022
  • 3 replies
  • 2467 views

Hi all,

 

I am using this code to change the color of a text layer. 

 

var mySourceText = layer.property("Source Text");
var textDocument = mySourceText.value;
  
textDocument.fillColor = RGBcolor;
textDocument.strokeColor = RGBcolor;
  
mySourceText.setValue(textDocument);

 

It works fine if the text has the same style. 

If not uniform, it changes the text style to match the first character style.
For example, if I want to change this text to green:


This is what I'd like to get:

However, this is what I get:

Any ideas?

This topic has been closed for replies.
Correct answer Douglas_Waterfall

We have what you want now available in Beta.

 

https://community.adobe.com/t5/after-effects-beta-discussions/per-character-scripting-public-beta-announcement/td-p/14247138

 

Douglas Waterfall

After Effects Engineering

3 replies

Douglas_WaterfallCorrect answer
Adobe Employee
November 21, 2023

We have what you want now available in Beta.

 

https://community.adobe.com/t5/after-effects-beta-discussions/per-character-scripting-public-beta-announcement/td-p/14247138

 

Douglas Waterfall

After Effects Engineering

dbDavideBoscolo
Legend
November 21, 2023

I've just seen it on X! Great update thank you! 

Mathias Moehl
Community Expert
Community Expert
August 23, 2022
Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
dbDavideBoscolo
Legend
August 31, 2023

Where has this gone now?

Mathias Moehl
Community Expert
Community Expert
September 1, 2023

I think there is no such public place to vote for feature requests anymore...

 

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
Dan Ebberts
Community Expert
Community Expert
August 23, 2022

Unfortunately, that's how it works. If your script modifies the text document, everything gets the styling of the first character. You have to use multiple text layers.

dbDavideBoscolo
Legend
August 23, 2022

Oh!, ok thank you Dan. I'll cope with that.

Cheers!