I'm using moderncv and by default the links I set via \href{}{}
seem to have the same color as normal text. How do I change their color?
I tried to add (according to How to change the color of \href links… for real):
\definecolor{links}{HTML}{2A1B81}
\hypersetup{colorlinks,linkcolor=,urlcolor=links}
The document failed building with
Undefined control sequence. l.33 \hypersetup
{colorlinks,linkcolor=,urlcolor=links}
Another failed try was:
\usepackage[colorlinks=true,linkcolor=black]{hyperref}
That gave the error:
LaTeX Error: Option clash for package hyperref.
Best Answer
Here is a solution.
hyperref
is loaded at the end of the preamble with\AtEndPreamble
. We need to passcolorlinks,linkcolor=true
options to the package, one way is to make it global\documentclass[colorlinks,linkcolor=true]{moderncv}
and than\hypersetup{urlcolor=thecolor}
after\begin{document}
MWE