Assign / automate font colors based on letter patterns?
I have a document for which I'm creating custom symbols as a font. I'm using the custom font in a character style, and I need to be able to change colors of the fonts based on the order in which they appear. So, for example, I have a # symbol as the letter A, and the ampersand as the letter B.
I type "AB" and apply my symbol font character style, and get #&.
Based on the colors I need (and am currently applying manually), it should look like:
#&
However, sometimes, the characters (but not the colors) are reversed:
&#
and I will always need the second letter (and any after that) to be orange.
Is there a way to do this so as to avoid manually applying color to every instance?
Or, somehow, of programmatically applying the color so that when I clear overrides, the font colors remain?
I think the answer may be somewhere in GREP, but I haven't used it enough yet to... know how to do it 🙂 I searched a bit, but am not sure what GREP functions would be used. I assume it would be something like telling GREP that every time text has a specific character style, any letters after the first should have a duplicate character style with a specific color applied. Something like that?
Any thoughts?
TIA
