LaTeX forum ⇒ Curricula Vitae / RésumésEach section a different color Topic is solved

ModernCV, Friggeri, Plasmati, Classicthesis-CV, and more
templateuser
Posts: 679
Joined: Tue Mar 03, 2015 4:01 pm

Each section a different color

Postby templateuser » Thu Mar 19, 2015 12:47 pm

First of all, great job with this template, I love it, thank you so much! However, I'd like to know if it's possible to have sections with different colors in the same page please? Like Education blue and Experience green? Thanks in advance

gcunhase

Tags:

User avatar
Vel
Site Moderator
Posts: 454
Joined: Fri Jun 29, 2012 1:20 am

Postby Vel » Thu Mar 19, 2015 12:47 pm

Hi,

Sure, you can do this with the \color command like this:

  1. \section{\color{red}{Education}}


Cheers,
Vel
Founder and administrator of LaTeXTemplates.com and LaTeXTypesetting.com

templateuser
Posts: 679
Joined: Tue Mar 03, 2015 4:01 pm

Postby templateuser » Thu Mar 19, 2015 12:47 pm

Thank you, but what about the bar to the left of the section name? It doesn't change color when I use this command. Thank you again :)

gcunhase

User avatar
Vel
Site Moderator
Posts: 454
Joined: Fri Jun 29, 2012 1:20 am

Postby Vel » Thu Mar 19, 2015 12:47 pm

Hi,

This will be a bit trickier to change. The rule color is defined in this line in moderncvclassic.sty:

  1. \parbox[t]{\hintscolumnwidth}{\strut\raggedleft\raisebox{\baseletterheight}%
  2. {\color{color1}\rule{\hintscolumnwidth}{0.95ex}}}


You'll notice it's hard-coded for the document to be "color1". If you want to be able to change this per section, I'd recommend adding another parameter to \section with the color you'd like to use. You'll then always need to specify the color whenever you use \section in the document.

Good luck!

Cheers,
Vel
Founder and administrator of LaTeXTemplates.com and LaTeXTypesetting.com

CarolinaTL
Posts: 1
Joined: Thu Sep 27, 2018 4:32 am

Postby CarolinaTL » Thu Sep 27, 2018 4:56 am

Hi, Vel!
I was looking for that rule color line that you said, but I didn't find it, maybe that line code does not exist in the last ModernCV version which is the one I'm using, but I'm not sure. Anyway, in the 2015 version, I think the line that modifies color in a section is found in the file moderncvbodyi.sty, and it is the following:

% styles
\renewcommand*{\sectionstyle}[1]{{\sectionfont\textcolor{color1}{#1}}}
\renewcommand*{\subsectionstyle}[1]{{\subsectionfont\textcolor{color1}{#1}}}
\renewcommand*{\hintstyle}[1]{{\hintfont\textcolor{color0}{#1}}}

However, I don't know how to modify that in order to have a different color in each section, included its bar to the left. tHe reason is that I want make my CV with a 'colorful' ModernCV style. Thus, could you explain me how can I bring your idea "add another parameter to \section with the color you'd like to use. You'll then always need to specify the color whenever you use \section in the document." to life?

Thanks in advance!


Return to “Curricula Vitae / Résumés”

Who is online

Users browsing this forum: Stefan Kottwitz and 2 guests