Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Text Color Expression

  • Text Color Expression

    Posted by Aviram Avidan on February 18, 2014 at 6:48 pm

    Hello, Is there a way to type a text and tell it that I want every second letter in a specific color?

    example.. lets say I’m typing the word “SCHOOL”. and I want the S to be in color #1, C to be in color #2, H again in color #1..etc.

    I need like a preset because I work for a TV channel that has a specific graphic kit that involves this sort of design with different titles every time and It’s very frustrating to go letter by letter and change the color…a preset could really save me a lot of time.

    thank you.

    Christoph Heil replied 9 years, 5 months ago 3 Members · 5 Replies
  • 5 Replies
  • Dan Ebberts

    February 18, 2014 at 10:52 pm

    This would be one way to do it. Set your text up in color 1. Add a fill color Animator and set it to color 2. Add and expression selector and set its Amount expression to this:

    textIndex%2 ? 0 : 100

    That should set letters 2,4,6… to color 2. I’m guessing you could save that as a preset, but I haven’t tried it.

    Dan

  • Aviram Avidan

    February 19, 2014 at 10:11 pm

    that’s brilliant!! it works!!

    only one problem though….how can i tell the expression to ignore spaces? now when i type a new word in the text layer it treats the space as a character and the result is 2 letters in the same color..the last letter of the first word, and the first letter in the second word…

  • Dan Ebberts

    February 19, 2014 at 10:39 pm

    In the expression selector, set Based On to Characters Excluding Spaces.

    Dan

  • Aviram Avidan

    February 21, 2014 at 1:08 pm

    You have no idea how much time you saved me. it’s work perfect now. thank you!!

  • Christoph Heil

    December 13, 2016 at 9:34 am

    Hi Dan!

    I Have a similar question: i need to set the last character from my text-layer to a different color. unfortunately this is a letter that comes from the expression below

    can you tell me how to set this “|” to a different color than the rest of the text?

    Thanks in advance!
    boomziboi


    L = text.sourceText.length;
    T = time*effect("Speed")("Slider") - effect("Start At")("Slider")*effect("Speed")("Slider");
    F = Math.round(time % 1);
    if(F == 1 | (T0) ){Fl = "|";}else{Fl=" ";}
    substr(0,T) + Fl

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy