Skip to main content
Participant
August 19, 2022
Question

To make part of text layer in a different colour and templatable

  • August 19, 2022
  • 3 replies
  • 331 views

Hey, I have a problem with setting an after effects template in which the color of a text layer (1 line) needs to be splited before and after “ - ”. 

 

The look of text layer that I want to achieve is like image below:

This needs to be templatable. For example if I type "GRACE GOODMAN - SALES MANAGER, EK", the line needs to show the name in black and the rest in red, in one line. 

 

I watched some tutorials about using split expression. Think I can use this expression to split the line before and after " - ", but now I'm stucked on how to color.  I was thinking to use range selector under RGB color and make the percentage of start / end controlled by using the result of split expression somehow (Still exploring how to do this part).

 

Is my way above gonna work? Or is there a easier way to achieve this?

 

Thanks very much. 

This topic has been closed for replies.

3 replies

OussK
Community Expert
Community Expert
August 20, 2022

Try this https://we.tl/t-hvWOPY1BbM this template is based on Dan's solution, but I add one extra controller so you can control both colors 

Participant
August 20, 2022

Hey Ouss, thanks so much for building this template. I tried it and it works perfectly. Thanks again!

Community Expert
August 20, 2022

If you are building a MOGRT, I think the easiest solution is to tie two text layers to each other using sourceRectAtTime(). You can stick the red layer on the end of the Name layer and adjust the size and spacing automatically. There would be two text fields to enter in Premiere Pro. I do that kind of thing all the time with multiple lines of text.

Participant
August 20, 2022

Hey Rick, thanks for the reply.  Though I didn't figure out how to use source text at times(). expression to tie two text layers one after the other, I borrowed the idea of using two text layers as text source and combine them in the final display text layer,  then controled the coloring area using Dan's solution.  The two text layers idea makes editing in mogrt.  file pretty easy (which is what I need). I will give another try of using sourceRectAtTime(). expression later (sorry I am quiet new to expressions) and thanks again for your reply!

Dan Ebberts
Community Expert
Community Expert
August 20, 2022

You could add an RGB Fill Animator (set to your red color), add an Expression Selector, and replace the Expression Selector's Amount property expression with this:

txt = text.sourceText.value;
idx = txt.indexOf("-");
textIndex > idx ? 100 : 0

 

Participant
August 20, 2022

Hey Dan, thanks heaps for these expression lines. It solved the problem efficiently!