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}
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}
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}
EDITED to totally replace my earlier attempt, which did not meet the OP's specifications.
EDITED to provide 2nd TRIAL VERSION.
SAFE VERSION:
With the 1st (safer) version, I was unable to make the year in the cite colored, because apparently it uses a sorting pattern on that field (the #3
argument to \harvarditem
), and therefore must remain alphabetic. I accomplished what I did by redefining \harvarditem
to call on \[ref]color
where [ref]
is the cite key. These colors are defined by \refcolor{A01}{green}
which, for example, defines a macro \A01color
as {green}
.
\documentclass{article}
\usepackage{xcolor,ifthen,filecontents}
\usepackage[authoryear,colon,square]{natbib}
\bibliographystyle{dcu}
\def\refcolor#1#2{\expandafter\xdef\csname#1color\endcsname{#2}}
\refcolor{A01}{green}
\refcolor{A01b}{cyan}
\refcolor{C03}{red}
\def\setbibcolor#1{%
\expandafter\ifx\csname#1color\endcsname\relax%
\color{black}%
\else%
\color{\csname#1color\endcsname}%
\fi%
}
\makeatletter
\renewcommand\harvarditem[4][]{%
\if\relax#1\relax
\setbibcolor{#4}\bibitem[\setbibcolor{#4}#2(#3)]{#4}%
\else
\bibitem[#1(#3)#2]{#4}%
\fi
}%
\makeatother
\begin{filecontents}{mybib.bib}
@misc{A01,
author = {Author, A.},
year = {2001},
title = {Alpha}
}
@misc{A01b,
author = {Author, A.},
year = {2001},
title = {Alpha TWO}
}
@misc{B02,
author = {Buthor, B.},
year = {2002},
title = {Bravo}
}
@misc{C03,
author = {Cuthor, C.},
year = {2003},
title = {Charlie}
}
@misc{D04,
author = {Duthor, D.},
year = {2004},
title = {Delta}
}
\end{filecontents}
\begin{document}
cite \cite{A01, A01b, B02, C03, D04}
\bibliography{mybib}
\end{document}
TRIAL UPDATE:
By redefining
\renewcommand\harvarditem[4][]{%
\if\relax#1\relax
\setbibcolor{#4}\bibitem[\setbibcolor{#4}#2\ {[}#3{]}()]{#4}%
\else
\bibitem[#1(#3)#2]{#4}%
\fi
}%
as such, I get the desired result for this MWE. However, I am not sure what I may have broken in the process... year-based sorting, I presume. Clearly I fixed the year delimiters as []
but there may be other things, too. But here it is, if it suits.
Best Answer
should do.