[Tex/LaTex] Why can’t I change text color but I can still change the color of font awesome icons

colorfontawesomelinks

I have what it seems a very simple question, but I still cannot solve it, and I haven't been able to reproduce the problem outside Friggeri's CV template (sorry for that).

The whole thing is trying to have a default text color that still allows me to change the color of specific words/phrases.

I am using Friggeri's CV template with the same friggeri-cv.cls (I have only changed all the Helvetica fonts to Arial and added backend=biber to the \RequirePackage{biblatex} line).

This is a MWE, where you can see text doesn't change color, but the flag does. Isn't font awesome considered text?

%!TEX TS-program = xelatex
\documentclass[]{friggeri-cv}
\listfiles
\addbibresource{bibliography.bib}

\usepackage{fontawesome}
\newfontfamily{\FA}{FontAwesome}

\begin{document}
\header{name}{surname}
       {occupation}

% In the aside, each new line forces a line break
\begin{aside}
  \section{sec}
    aaa
    bbb
\end{aside}


\section{sec}
\begin{entrylist}
  \entry
    {2014}
    {some text here}
    {more here}
    {and more text

    and \textcolor{red}{text in color}

    and an icon \textcolor{red}{\faFlag}

    and even a \href{http://tex.stackexchange.com/}{link}
    }
\end{entrylist}


\end{document}

Now, I know there is this line in the .cls file

 \colorlet{textcolor}{gray}

that controls default text color, but I still want the default text color to be like that, why doesn't \textcolor{red} override it?

I only get colored text when I comment that line…

This brings me to the problem of customizing links… I use the following line in the .cls file (but it doesn't work if I use it in the .tex file) to remove the box around links:

 \usepackage[hidelinks]{hyperref}

But can I make all links be blue and underlined, for example? The option urlcolor=blue in the above command doesn't seem to do anything…

EDIT:

I get the following with the MWE above:

this

A big big plus would be to get rid of the underfull hbox warning too, if possible!

Many thanks

EDIT 2:

At the end of the log file, \listfiles lists the following:

 *File List*
friggeri-cv.cls    2012/04/30 CV class
 article.cls    2007/10/19 v1.4h Standard LaTeX document class
  size10.clo    2007/10/19 v1.4h Standard LaTeX file (size option)
  xcolor.sty    2007/01/21 v2.11 LaTeX color extensions (UK)
   color.cfg    2007/01/18 v1.5 color configuration of teTeX/TeXLive
  pdftex.def    2011/05/27 v0.06d Graphics/color for pdfTeX
infwarerr.sty    2010/04/08 v1.3 Providing info/warning/error messages (HO)
 ltxcmds.sty    2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
pdftexcmds.sty    2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)
   ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO)
luatex-loader.sty    2010/03/09 v0.4 Lua module loader (HO)
fontspec.sty    2013/05/20 v2.3c Font selection for XeLaTeX and LuaLaTeX
   expl3.sty    2014/01/07 v4646 L3 Experimental code bundle wrapper
 l3names.sty    2014/01/04 v4640 L3 Namespace for primitives
l3bootstrap.sty    2014/01/04 v4640 L3 Experimental bootstrap code
  luatex.sty    2010/03/09 v0.4 LuaTeX basic definition package (HO)
    etex.sty    1998/03/26 v2.0 eTeX basic definition package (PEB)
l3basics.sty    2014/01/04 v4642 L3 Basic definitions
 l3expan.sty    2014/01/04 v4642 L3 Argument expansion
    l3tl.sty    2013/12/27 v4625 L3 Token lists
   l3seq.sty    2013/12/14 v4623 L3 Sequences and stacks
   l3int.sty    2013/08/02 v4583 L3 Integers
 l3quark.sty    2013/12/14 v4623 L3 Quarks
   l3prg.sty    2014/01/04 v4642 L3 Control structures
 l3clist.sty    2013/07/28 v4581 L3 Comma separated lists
 l3token.sty    2013/08/25 v4587 L3 Experimental token manipulation
  l3prop.sty    2013/12/14 v4623 L3 Property lists
   l3msg.sty    2013/07/28 v4581 L3 Messages
  l3file.sty    2013/10/13 v4596 L3 File and I/O operations
  l3skip.sty    2013/07/28 v4581 L3 Dimensions and skips
  l3keys.sty    2013/12/08 v4614 L3 Experimental key-value interfaces
    l3fp.sty    2014/01/04 v4642 L3 Floating points
   l3box.sty    2013/07/28 v4581 L3 Experimental boxes
l3coffins.sty    2013/12/14 v4624 L3 Coffin code layer
 l3color.sty    2012/08/29 v4156 L3 Experimental color support
l3luatex.sty    2013/07/28 v4581 L3 Experimental LuaTeX-specific functions
l3candidates.sty    2014/01/06 v4643 L3 Experimental additions to l3kernel
  xparse.sty    2013/12/31 v4634 L3 Experimental document command parser
luaotfload.sty    2014/02/05 v2.4-3 OpenType layout system
luatexbase.sty    2013/05/11 v0.6 Resource management for the LuaTeX macro progr
ammer
luatexbase-compat.sty    2011/05/24 v0.4 Compatibility tools for LuaTeX
luatexbase-modutils.sty    2013/05/11 v0.6 Module utilities for LuaTeX
luatexbase-loader.sty    2013/05/11 v0.6 Lua module loader for LuaTeX
luatexbase-regs.sty    2011/05/24 v0.4 Registers allocation for LuaTeX
luatexbase-attr.sty    2013/05/11 v0.6 Attributes allocation for LuaTeX
luatexbase-cctb.sty    2013/05/11 v0.6 Catcodetable allocation for LuaTeX
luatexbase-mcb.sty    2013/05/11 v0.6 Callback management for LuaTeX
fontspec-patches.sty    2013/05/20 v2.3c Font selection for XeLaTeX and LuaLaTeX

fixltx2e.sty    2006/09/13 v1.1m fixes to LaTeX
fontspec-luatex.sty    2013/05/20 v2.3c Font selection for XeLaTeX and LuaLaTeX
 fontenc.sty
  eu2enc.def    2010/05/27 v0.1h Experimental Unicode font encodings
  eu2lmr.fd    2009/10/30 v1.6 Font defs for Latin Modern
xunicode.sty    2011/09/09 v0.981 provides access to latin accents and many othe
r characters in Unicode lower plane
 eu2lmss.fd    2009/10/30 v1.6 Font defs for Latin Modern
graphicx.sty    1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
  keyval.sty    1999/03/16 v1.13 key=value parser (DPC)
graphics.sty    2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg    2010/04/23 v1.9 graphics configuration of TeX Live
fontspec.cfg
unicode-math.sty    2013/05/04 v0.7e Unicode maths in XeLaTeX and LuaLaTeX
 ifxetex.sty    2010/09/12 v0.6 Provides ifxetex conditional
l3keys2e.sty    2013/12/31 v4634 LaTeX2e option processing using LaTeX3 keys
catchfile.sty    2011/03/01 v1.6 Catch the contents of a file (HO)
etexcmds.sty    2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
  fix-cm.sty    2006/09/13 v1.1m fixes to LaTeX
  ts1enc.def    2001/06/05 v3.0e (jk/car/fm) Standard LaTeX file
filehook.sty    2011/10/12 v0.5d Hooks for input files
unicode-math-luatex.sty    
lualatex-math.sty    2013/08/03 v1.3 Patches for mathematics typesetting with Lu
aLaTeX
etoolbox.sty    2011/01/03 v2.1 e-TeX tools for LaTeX
unicode-math-table.tex
    tikz.sty    2010/10/13 v2.10 (rcs-revision 1.76)
     pgf.sty    2008/01/15 v2.10 (rcs-revision 1.12)
  pgfrcs.sty    2010/10/25 v2.10 (rcs-revision 1.24)
everyshi.sty    2001/05/15 v3.00 EveryShipout Package (MS)
  pgfrcs.code.tex
 pgfcore.sty    2010/04/11 v2.10 (rcs-revision 1.7)
  pgfsys.sty    2010/06/30 v2.10 (rcs-revision 1.37)
  pgfsys.code.tex
pgfsyssoftpath.code.tex    2008/07/18  (rcs-revision 1.7)
pgfsysprotocol.code.tex    2006/10/16  (rcs-revision 1.4)
 pgfcore.code.tex
pgfcomp-version-0-65.sty    2007/07/03 v2.10 (rcs-revision 1.7)
pgfcomp-version-1-18.sty    2007/07/23 v2.10 (rcs-revision 1.1)
  pgffor.sty    2010/03/23 v2.10 (rcs-revision 1.18)
 pgfkeys.sty    
 pgfkeys.code.tex
  pgffor.code.tex
    tikz.code.tex
 parskip.sty    2001/04/09 non-zero parskip adjustments
 textpos.sty    2014/01/03 v1.7j
biblatex.sty    2013/11/25 v2.8a programmable bibliographies (PK/JW/AB)
biblatex2.sty    2013/11/25 v2.8a programmable bibliographies (biber) (PK/JW/AB)

kvoptions.sty    2011/06/30 v3.11 Key value format for package options (HO)
kvsetkeys.sty    2012/04/25 v1.16 Key value parser (HO)
  logreq.sty    2010/08/04 v1.0 xml request logger
  logreq.def    2010/08/04 v1.0 logreq spec v1.0
  ifthen.sty    2001/05/26 v1.1c Standard LaTeX ifthen package (DPC)
     url.sty    2013/09/16  ver 3.4  Verb mode for urls, etc.
  blx-dm.def
 verbose.dbx
biblatex-dm.cfg
blx-compat.def    2013/11/25 v2.8a biblatex compatibility (PK/JW/AB)
biblatex.def    
standard.bbx    2013/11/25 v2.8a biblatex bibliography style (PK/JW/AB)
authortitle.bbx    2013/11/25 v2.8a biblatex bibliography style (PK/JW/AB)
 verbose.bbx    2013/11/25 v2.8a biblatex bibliography style (PK/JW/AB)
 verbose.cbx    2013/11/25 v2.8a biblatex citation style (PK/JW/AB)
biblatex.cfg    
geometry.sty    2010/09/12 v5.6 Page Geometry
  ifvtex.sty    2010/03/01 v1.5 Detect VTeX and its facilities (HO)
hyperref.sty    2012/11/06 v6.83m Hypertext links for LaTeX
hobsub-hyperref.sty    2012/05/28 v1.13 Bundle oberdiek, subset hyperref (HO)
hobsub-generic.sty    2012/05/28 v1.13 Bundle oberdiek, subset generic (HO)
  hobsub.sty    2012/05/28 v1.13 Construct package bundles (HO)
 intcalc.sty    2007/09/27 v1.1 Expandable calculations with integers (HO)
kvdefinekeys.sty    2011/04/07 v1.3 Define keys (HO)
pdfescape.sty    2011/11/25 v1.13 Implements pdfTeX's escape features (HO)
bigintcalc.sty    2012/04/08 v1.3 Expandable calculations on big integers (HO)
  bitset.sty    2011/01/30 v1.1 Handle bit-vector datatype (HO)
uniquecounter.sty    2011/01/30 v1.2 Provide unlimited unique counter (HO)
letltxmacro.sty    2010/09/02 v1.4 Let assignment for LaTeX macros (HO)
 hopatch.sty    2012/05/28 v1.2 Wrapper for package hooks (HO)
xcolor-patch.sty    2011/01/30 xcolor patch
atveryend.sty    2011/06/30 v1.8 Hooks at the very end of document (HO)
atbegshi.sty    2011/10/05 v1.16 At begin shipout hook (HO)
refcount.sty    2011/10/16 v3.4 Data extraction from label references (HO)
 hycolor.sty    2011/01/30 v1.7 Color options for hyperref/bookmark (HO)
 auxhook.sty    2011/03/04 v1.3 Hooks for auxiliary files (HO)
  pd1enc.def    2012/11/06 v6.83m Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg    2002/06/06 v1.2 hyperref configuration of TeXLive
 hpdftex.def    2012/11/06 v6.83m Hyperref driver for pdfTeX
rerunfilecheck.sty    2011/04/15 v1.7 Rerun checks for auxiliary files (HO)
fontawesome.sty    2013/05/10 v3.1.1 font awesome icons
 english.lbx    2013/11/25 v2.8a biblatex localization (PK/JW/AB)
   t3cmr.fd    2001/12/31 TIPA font definitions
supp-pdf.mkii
epstopdf-base.sty    2010/02/09 v2.5 Base part for package epstopdf
  grfext.sty    2010/08/19 v1.1 Manage graphics extensions (HO)
epstopdf-sys.cfg    2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
      cv.bbl
 nameref.sty    2012/10/27 v2.43 Cross-referencing by name of section
gettitlestring.sty    2010/12/03 v1.4 Cleanup title references (HO)
      cv.out
      cv.out
 ***********

NEW EDIT:

I have tried to reproduce the error without using Friggeri's template, but with no success, the following line does not have the desired effect:
\colorlet{textcolor}{blue}
But it has to be done that way, cause I don't want to touch Friggeri's template much… anybody has any idea?

This is the MWE

%!TEX TS-program = xelatex
\documentclass{article}
\listfiles
\usepackage{xcolor}
\usepackage{hyperref}
\usepackage{fontawesome}
\newfontfamily{\FA}{FontAwesome}

\colorlet{textcolor}{blue}

\begin{document}
and more text

and \textcolor{red}{text in color}

and an icon \textcolor{red}{\faFlag}

and even a \href{http://tex.stackexchange.com/}{link}

\end{document}

Best Answer

Font coloring

The class friggery-cv.cls sets the Color attribute to the font:

\colorlet{textcolor}{gray}
\setmainfont[Mapping=tex-text, Color=textcolor]{Helvetica Neue Light}

Then the color is part of the font and cannot be changed from the outside. This is shown by the following example. \textcolor{red} is working as the red \fbox shows, but the font remains blue:

\documentclass{article}
\usepackage{xcolor}
\usepackage{fontspec}
\setmainfont[Color=blue]{FreeSans}

\begin{document}
  Hello \textcolor{red}{\fbox{World}}
\end{document}

Result

Workarounds

  • A new font without the feature Color can be defined. Then \textcolor applies to the colorless font.

  • The following example changes the Color attribute of the current font:

    \documentclass{article}
    \usepackage{xcolor}
    \usepackage{fontspec}
    \setmainfont[Color=blue]{FreeSans}
    
    \begin{document}
      Hello {\addfontfeature{Color=red}World}
    \end{document}
    

    Result

Link customization

Blue underlined links, see hyperref's README, section "Link border style".

\documentclass{article}
\usepackage{xcolor}
\usepackage{hyperref}
\hypersetup{
  allbordercolors=blue,
  pdfborderstyle={/S/U/W 1},
}

\begin{document}
  \tableofcontents
  \section{Test section}
  \label{sec:test}
  A reference to \hyperref[sec:test]{this section}.

  This example can be found in
  \href{http://tex.stackexchange.com/a/183340/16967}{this answer}.

  URL of the question:
  \url{http://tex.stackexchange.com/q/183170/16967}
\end{document}

Result