# Change the color of rule in moderncv

I have a question about moderncv. I want to work with the moderncv style casual and would like to change the color of the rule in the cvtitle which is defined by

{\color{color2!50}\rule{\textwidth}{.25ex}}


I defined a color by \definecolor{dagr}{rgb}{0.35,0.35,0.35} and would like to use this color instead of color2!50. How can I do that?

• I suppose \color{dagr}\rule{\textwidth}{.25ex}} should work. – Bernard Feb 4 '14 at 21:50

You can patch \makecvtitle and change the color:

\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{casual}
\moderncvcolor{blue}
\usepackage[scale=0.75]{geometry}
\usepackage{etoolbox}

\definecolor{dagr}{rgb}{0.35,0.35,0.35}
\patchcmd{\makecvtitle}
{\color{color2!50}\rule{\textwidth}{.25ex}}
{\color{dagr}\rule{\textwidth}{.25ex}}
{}
{}

\name{John}{Doe}
\title{Title}