# moderncv: Font selection and color customization

For the following MWE,

\RequirePackage{luatex85}
\documentclass[12pt,sans]{moderncv}
\usepackage[tuenc]{fontspec}
\usepackage{xcolor}

\moderncvstyle{banking}
\moderncvcolor{blue}

\name{Diaa}{}
\begin{document}
\makecvtitle
\section{Education}
\cvitem{Title}{Some Title}
\subsection{Philosophy of Doctor}
\cventry{year}{Ph.D.}{University}{City}{}{}
\end{document}


the output is

However, when changing the font to roman in the class options, the blue and black colors fade in addition to the loss of boldness of the headers and the output becomes

Therefore, my first question is how to change the font to Roman without losing the colors saturation and headers boldness?

Additionally, how to customize the color in \moderncvcolor{blue} to be, for example, black!20!blue without getting errors?

• I measured the colors in the two cases and I get, in RGB, (56,115,178) in both cases: the problem is simply that the sans serif has thicker strokes. – egreg Jun 17 '18 at 8:53

The colors are actually the same, but in the sans example the strokes are thicker.

When roman is used, moderncv wants to use Pagella, leading to

LaTeX Font Warning: Font shape TU/qpl/b/it' undefined
(Font)              using TU/qpl/b/n' instead on input line 19.


You need to countermand this by declaring your main font and also to remove the request for a (non existing) semibold font.

\documentclass[12pt,roman]{moderncv}
\usepackage{fontspec}
\usepackage{xcolor}

\moderncvstyle{banking}
\moderncvcolor{blue}

\setmainfont{TeX Gyre Pagella}

\renewcommand*{\sectionfont}{\Large\bfseries\upshape}
\renewcommand*{\subsectionfont}{\large\bfseries\itshape}
\renewcommand*{\hintfont}{\bfseries}

\name{Diaa}{}

\begin{document}
\makecvtitle
\section{Education}
\cvitem{Title}{Some Title}
\subsection{Philosophy of Doctor}
\cventry{year}{Ph.D.}{University}{City}{}{}
\end{document}


Declare a different main font, if you so wish.

In order to change the base color, use \colorlet:

\documentclass[12pt,roman]{moderncv}
\usepackage{fontspec}
\usepackage{xcolor}

\moderncvstyle{banking}
\moderncvcolor{blue}

%\colorlet{color1}{black!20!blue}
\colorlet{color1}{red}

\renewcommand*{\sectionfont}{\Large\bfseries\upshape}
\renewcommand*{\subsectionfont}{\large\bfseries\itshape}
\renewcommand*{\hintfont}{\bfseries}
\setmainfont{TeX Gyre Pagella}

\name{Diaa}{}
\begin{document}
\makecvtitle
\section{Education}
\cvitem{Title}{Some Title}
\subsection{Philosophy of Doctor}
\cventry{year}{Ph.D.}{University}{City}{}{}
\end{document}


Here I have used red to give a very distinctive example.