I'm using the awesome-cv class, which highlights the first three letters of the section heading like so:
The code that produces this effect looks like this:
\RequirePackage{xcolor}
\RequirePackage{xifthen}
\RequirePackage{etoolbox}
\RequirePackage[quiet]{fontspec}
\RequirePackage{fontawesome}
\definecolor{awesome-red}{HTML}{DC3522}
\colorlet{awesome}{awesome-red}
\newcounter{colorCounter}
\def\@sectioncolor#1#2#3{%
{%
\color{%
\ifcase\value{colorCounter}%
awesome\or%
awesome\or%
awesome\or%
awesome\or%
awesome\else%
awesome\fi%
} #1#2#3%
}%
\stepcounter{colorCounter}%
}
The text size and boldface are added later in
\newcommand*{\sectionstyle}[1]{{\fontsize{15pt}{1em}\bodyfont\bfseries\color{text}\@sectioncolor #1}}
How does the first part of this code highlight the first three letters?
I understand that this isn't a MWE, but I wasn't able to create one out of the .cls file and I don't think this code is that complex to someone who knows what they're looking at. If I need and MWE, let me know.


\@sectioncolorare the first three characters#1#2#3. Similar to how\frac12produces the fraction1/2. Note that when\@sectioncoloris called its parameters are not enclosed in a brace group. – Peter Grill Mar 23 '16 at 22:19#3doesn't change the highlighting to the first two characters, it causes a crash. – Azor Ahai -him- Mar 23 '16 at 22:21#1#2#3to#1#2following thecolor? If you changed it#1#2#3to#1#2in both places it should highlight just the first two characters. After the first three characters are processed,\@sectioncolorhas done its on and the remaining characters are just text that is not processed by ``@sectioncolor. Same as$\frac123$producing the fraction1/2followed by3. – Peter Grill Mar 23 '16 at 22:25