5

I'm making a CV in LaTeX with the moderncv-class. Is there a way to use a new-defined color for the input of \moderncvcolor{defined-color}?

My code is:

\documentclass[a4paper, fontsize=10pt]{moderncv}


% Schriftart
\usepackage[scaled=.92]{helvet}                 % Helvetica (skaliert) als serifenlose Schriftart (Standard fuer serifenlose Schrift)  -- besser geeigent zum Lesen am BILDSCHIRM
    \renewcommand{\familydefault}{\sfdefault}       % (Eingestellte) serifenlose Schrift als Standardschrftart (fuer Fliesstext)
%\usepackage{lmodern}                           % Besser lesbare Standardschriftart (Serifenschrift) -- besser geeigent zum Lesen auf PAPIER
%   \renewcommand{\familydefault}{\rmdefault}       % (Eingestellte) Serifenschriftart als Standardschrift (fuer Fliesstext)
%\setkomafont{sectioning}{\rmfamily\bfseries}   % Ueberschriften in Serifenschrift (fett)
%\setkomafont{sectioning}{\rmfamily}            % Ueberschriften in Serifenschrift (plain)
\usepackage{xcolor}                             % Textfarbe aendern - Fuer Dokument, Paragraph oder diskrete Texteile mit '\textcolor{Farbe}{Text}'
    \definecolor{myblue}{HTML}{004c88}
%------------------------------------------------------------

% Ausgabe von Umlauten (vor 'inputenc' einbinden!)
\usepackage[T1]{fontenc}        % Schoene Ausgabe von Umlauten
%------------------------------------------------------------


% Deutsche Eingabe
\usepackage[utf8]{inputenc}     % Umlaute direkt eingeben   UTF-8 zur besseren Zusammenarbeit mit vers. Betriebssystemen
\usepackage[ngerman]{babel}     % deutsche Eingabe (Zur Eingabe von Umlauten wird 'inputenc' benötigt)
%------------------------------------------------------------

%

\usepackage{etoolbox}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{tweaklist}
\usepackage{calc}
\usepackage{xparse}
\usepackage{microtype}


%--------------- EINSTELLUNGEN LEBENSLAUF ------------------
\moderncvstyle{casual}  % Optionen: casual, classic, oldstyle, banking
%\moderncvcolor{blue}   % works
\moderncvcolor{myblue}  % does not

%------------------------------------------------------------
%---------------------ANGABEN LEBENSLAUF---------------------
%------------------------------------------------------------
\firstname{Firstname}
\familyname{Lastname}
\title{CirVit...}
\address{Streetdrive 20}{12345 Cityville}{}
\mobile{+00 123 455 677}
\email{[email protected]}


\begin{document}
    \makecvtitle
    \section{Personal}
    \cvitem{A Date}{01. Feb 1900}
    \cvitem{City of Birth}{Cityville}
    \cvitem{another}{item}
\end{document}
0

1 Answer 1

9

The \moderncvcolor{mycolor} macro does not apply a color, but loads a package named moderncvcolormycolor.sty.

You can create such file for yourself based on this template (taken from \moderncvcolor{green}):

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{moderncvcolorgreen}[2015/07/28 v2.0.0 modern curriculum vitae and letter color scheme: green]

\definecolor{color0}{rgb}{0,0,0}% black
\definecolor{color1}{rgb}{0.35,0.70,0.30}% green
\definecolor{color2}{rgb}{0.45,0.45,0.45}% dark grey

\endinput

Save it as moderncvcolormycolor.sty and load with \moderncvcolor{mycolor}.

5
  • 3
    Why not just redefine color0, color1 and color2... Seems simpler to me than creating a new .sty file
    – koleygr
    Feb 1, 2018 at 20:14
  • creating a new file that way doesn't work that easy :) the compiler won't find it. But i redefined the values in a existing file - so i got that going for me. Thank you Feb 1, 2018 at 20:25
  • @koleygr It is indeed, simpler. I just kept the standard so that the \moderncvcolor still works. Feb 1, 2018 at 21:01
  • 1
    @MichaelSchmid Yes, it does work. You should put the .sty you created in the same folder as your main .tex file. I just tested here to make sure and it worked. See this marvelous color scheme! Feb 1, 2018 at 21:04
  • ok, thank you @PhelypeOleinik, now it works ;) It does not even necessarily have to be in the same folder as the main .tex-file. I simply forgot to rename the argument of \ProvidesPackage{} to the new name Feb 3, 2018 at 14:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .