# How to change the color of the hyperlink to mail address in moderncv class?

I am beginner in LaTeX, and experimenting with moderncv. I find that the hyperkink of the email is of the same light blue color as the surrounding info, failing to make clear that it is an hyperlink. A darker blue would be ideal. I have found below that one way to change this was to make a copy (and edit the copy) of the file moderncv.cls, into ie my moderncv.cls. I edited the two last lines below, and used the class mymoderncv but there is no change. I have tried the other suggestions without results either. What is the correct procedure, if any?

Link formatting: colors, underlines in moderncv

\AtBeginDocument{
\hypersetup{
baseurl       = http://,
pdfborder     = 0 0 1,

-
Maybe this question will help: tex.stackexchange.com/q/52071/12774 –  JohnReed May 15 '12 at 17:26
Not really. This works in a standard class, such as article, etc, but not in the "moderncv" class that enforces other settings. –  Yves May 15 '12 at 17:31

You can just wrap your \hypersetup command in \AtBeginDocument{...}. No need to fiddle with the .cls file:

\documentclass{moderncv}
\moderncvstyle{casual}
\firstname{Mister}
\familyname{X}
\AtBeginDocument{
}

\begin{document}
\makecvtitle

\section{Stuff}
\cventry{2012}{Accomplishment}{Institution}{City}{Country}{\href{mailto:mister@eggs.com}{Send me an e-mail!}}
\end{document}


If you want to get underlined links, you can adapt the solution from How can I have colored and underlined links with hyperref?:

\documentclass{moderncv}
\moderncvstyle{casual}
\firstname{Mister}
\familyname{X}
\AtBeginDocument{
\hypersetup{%
urlbordercolor=red,% url borders will be red
pdfborderstyle={/S/U/W 1}% border style will be underline of width 1pt
}
}
\begin{document}
Test
\makecvtitle

\section{Stuff}
\cventry{2012}{Accomplishment}{Institution}{City}{Country}{\href{mailto:mister@eggs.com}{Send me an e-mail!}}
\end{document}

-
Thanks. A lot more simple way...Would it be possible to make the link underlined also ?. Switching to a darker blue is better, but still not obviously an hyperlink. –  Yves May 15 '12 at 18:29
@Yves: Yup, that's possible: tex.stackexchange.com/questions/26071/… –  Jake May 15 '12 at 18:40
Again the moderncv settings seem to desactivate this option. Using the following has no effect... \AtBeginDocument{\hypersetup{% colorlinks=false,% hyperlinks will be black linkbordercolor=red,% hyperlink borders will be red pdfborderstyle={/S/U/W 1}% border style will be underline of width 1pt }} –  Yves May 15 '12 at 18:51
@Yves: Hm, it works for me: See my edited answer. –  Jake May 15 '12 at 18:59
I had the strange message: "Package hyperref Error: this color specification is not supported." However I have updated the "moderncv" package and now everything works as expected. Thanks a lot. –  Yves May 16 '12 at 16:48