11

With the fontawesome5 package one now has duotones. How can i set the second color?

\documentclass[a4paper]{scrartcl}
\usepackage[no-math]{fontspec}
\usepackage[pro]{fontawesome5}%
\begin{document}
\color{red}\faIcon[duotone]{university}
\end{document}

yields

enter image description here

Is there a way to change the gray color?

10

Starting with package version 5.13.0, changing the secondary color normally shouldn't be necessary because it automatically adapts to the current text color. If you still want to change it, you can use \faDuotoneSetSecondary to change the color:

\documentclass[a4paper]{scrartcl}
\usepackage{xcolor}
\usepackage[pro]{fontawesome5}%
\begin{document}
Default color: \textcolor{red}{\faIcon[duotone]{university}}

\faDuotoneSetSecondary{\color{orange}}
Orange: \textcolor{red}{\faIcon[duotone]{university}}
\end{document}

enter image description here

Old answer

There is currently no user-level interface for this but only a code level (expl3) interface: You have to set the \l_fontawesome_duotone_secondary_style_tl token list to the commands which should be called for the secondary layer:

\documentclass[a4paper]{scrartcl}
\usepackage{xcolor}
\usepackage[pro]{fontawesome5}

\ExplSyntaxOn

\tl_set:Nn \l_fontawesome_duotone_secondary_style_tl {
  \color{.!50!white} % Of course you could also load another color here
}

\ExplSyntaxOff

\begin{document}
\color{red}\faIcon[duotone]{university}
\end{document

enter image description here

I plan to add a proper interface in a later version, so that you will be able to set it with \fa??? {\color{secondarycolor}} but I'm not sure yet what \fa??? should be. Candidates are e.g. \faSecondaryColor, \faSetSecondary, \faSetSecondaryColor, \faDuotoneSetSecondary etc. If you have any suggestions feel free to comment here or send me a mail.

|improve this answer|||||
  • 1
    Awesome! Your solution is exactely what I was looking for because it now depends on the main color. Maybe that could get the default? And thanks for the info on the feature. One could also do \faIcon[duotone][secondary-color]{name} as an optional to change a single one; but a \faSetSecondary or \faDuotoneSetSecondary for the global would also be nice. Finally, one could play with the tikz features of .fg and .bg as first and second colors. – Ronny Feb 17 at 21:16
  • 3
    @Ronny The version in the answer might become the default in the next release. It's technically a breaking change, but it seems to be strictly better than the current one and it's mostly undocumented behaviour anyway. – Marcel Krüger Feb 17 at 21:18
  • That's why I opened the topic, I couldn't find a documentation. Thanks for answeing so fast, your solution works perfectly! – Ronny Feb 17 at 21:19
  • Your answer is between my favorities :-). – Sebastiano Feb 17 at 22:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.