1

I'm having an issue trying to change the text color of the email in moderncv.

I defined my own color like this :

\definecolor{mycolor}{RGB}{0,0,0}

Then I add the email like this :

\email{\textcolor{mycolor}{email@gmail.com}}

main.tex, line 45 Package xcolor Error: Undefined color `rgb(0,0,0)'. See the xcolor package documentation for explanation. Type H for immediate help. ... l.45 \makecvtitle Try typing to proceed If that doesn't work, type X to quit.

If I try it on the phone instead, it works

\phone[mobile]{\textcolor{mycolor}{+123456789}}

enter image description here

But I have no idea why it doesn't work for email

1

You can change the patch I used in your last question to solve this problem too.

Add the code

\usepackage{etoolbox}
\makeatletter
\patchcmd{\makecvhead} % <cmd>
  {\ifthenelse{\isundefined{\@email}}{}{\makenewline\emailsymbol\emaillink{\@email}}} % <search>
  {\ifthenelse{\isundefined{\@email}}{}{\makenewline\textcolor{mycolor}{\emailsymbol\emaillink{\@email}}}%
  } % <replace>
  {}{} % <success><failure>
\makeatother

to your preamble. So with the following MWE

\documentclass[10pt,a4paper,sans]{moderncv}

\moderncvstyle[right]{classic}
\moderncvcolor{burgundy}

\usepackage[utf8]{inputenc}
\usepackage[scale=0.8]{geometry}
\usepackage{setspace}
\usepackage{multicol}
\setlength{\hintscolumnwidth}{2.8cm}
\renewcommand*{\namefont}{\fontsize{24}{0}\bfseries\upshape}
\firstname{\vspace{2mm}John\vspace{2mm}}
\lastname{Doe}

\address{24 Groove Street, LA, USA}
\email{john.doe@gmail.com}
\photo[50pt][1pt]{photo}

\definecolor{mycolor}{RGB}{0,0,0}
\phone[mobile]{\textcolor{mycolor}{+123456789}}

\usepackage{etoolbox}
\makeatletter
\patchcmd{\makecvhead} % <cmd>
  {\ifthenelse{\isundefined{\@email}}{}{\makenewline\emailsymbol\emaillink{\@email}}} % <search>
  {\ifthenelse{\isundefined{\@email}}{}{\makenewline\textcolor{mycolor}{\emailsymbol\emaillink{\@email}}}%
  } % <replace>
  {}{} % <success><failure>
\makeatother


\begin{document}

\makecvtitle

\end{document}

you get the result:

enter image description here

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.