简体   繁体   中英

How to change color of the bar in ModernCV latex

I need to change the color of the bar related to the sections in the modernCV class in Latex. For example I defined a color "carmine" and I won't both the name of the section and the line related to it with that color. My code is the following:

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

\usepackage[scale = 0.9, right = 2cm, left = 2cm, top = 1cm, bottom = 1cm]{geometry}
\usepackage[showframe=true]{geometry}
\usepackage{enumitem}
\recomputelengths
\usepackage{etoolbox}

% moderncv themes
\moderncvstyle{classic} % style options are 'casual' (default), 'classic', 'oldstyle' and 'banking'

% Define color
\definecolor{carmine}{rgb}{0.59, 0.0, 0.09}

\moderncvcolor{blue} % color options 'blue' (default), 'orange', 'green', 'red', 'purple', 'grey' and 'black'

% character encoding
\usepackage[utf8]{inputenc} 

% if you want to change the width of the column with the dates:
\setlength{\hintscolumnwidth}{4.1cm} 

% personal data
\name{} 
\address{}
\phone[mobile]{}                   
\email{}   

% Picture:
\begin{figure}
    \centering
    \includegraphics[width=3cm]{}
    \label{fig:my_label}
\end{figure}
\begin{document}
\makecvtitle

\section{\color{carmine}{Blablabla}}

\end{document}

moderncv uses a colour called color1 (not really the most descriptive variable name...) for all these highlighting, you can simply modify this color:

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

\moderncvstyle{casual} 

% personal data
\name{John}{Doe}
\title{Resumé title}

\definecolor{carmine}{rgb}{0.59, 0.0, 0.09}
\colorlet{color1}{carmine}

\begin{document}

\makecvtitle

\section{BlaBla}

\end{document} 

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM