Adicione outra cor para uma seção no Friggeri Currículo/CV

Adicione outra cor para uma seção no Friggeri Currículo/CV

Então, estou escrevendo meu currículo usando o modelo de currículo maldito. Se parece com isso:

insira a descrição da imagem aqui

e pode ser encontrado aqui:

http://www.latextemplates.com/template/friggeri-resume-cv

Como você pode ver, todas as seções começam com as três primeiras letras em uma cor bonita. Porém, no .clsarquivo existem apenas seis cores definidas. Eu gostaria de ter sete seções e gostaria que a sétima seção também tivesse uma cor. Tentei adicionar um azul mais escuro usando o seguinte código:

\definecolor{darkblue}{HTML}{0000FF}

no início, e adicionando darkblue aqui:

\ifdefined\@cv@print
  \colorlet{green}{gray}
  \colorlet{orange}{gray}
  \colorlet{purple}{gray}
  \colorlet{brown}{gray}
  \colorlet{red}{gray}
  \colorlet{blue}{gray}
  \colorlet{darkblue}{gray}
  \colorlet{fillheader}{white}
  \colorlet{header}{gray}

e também adicionando darkblue aqui:

\newcounter{colorCounter}
\def\@sectioncolor#1#2#3{%
  {%
    \color{%
      \ifcase\value{colorCounter}%
        darkblue\or%
        blue\or%
        red\or%
        orange\or%
        green\or%
        purple\or%
        brown\else%
        headercolor\fi%
    } #1#2#3%
  }%
  \stepcounter{colorCounter}%
}

mas quando tento adicionar uma seção recebo um erro dizendo que a cor azul escuro não está definida. O que estou fazendo de errado? Nenhuma das outras cores é indicada em nenhum lugar além dessa forma.

Responder1

A lista de cores é controlada por \@sectioncolore usa apenas um \ifcase; aqui está a definição original:

\def\@sectioncolor#1#2#3{%
  {%
    \color{%
      \ifcase\value{colorCounter}%
        blue\or%
        red\or%
        orange\or%
        green\or%
        purple\or%
        brown\else%
        headercolor\fi%
    } #1#2#3%
  }%
  \stepcounter{colorCounter}%
}

Você pode simplesmente definir suas cores e adicioná-las à lista. No exemplo abaixo eu defini duas novas cores azul-petróleo e amarelo usando

\definecolor{teal}{HTML}{008080}
\definecolor{yellow}{HTML}{FFFF00}
\makeatletter
\def\@sectioncolor#1#2#3{%
  {%
    \color{%
      \ifcase\value{colorCounter}%
        blue\or%
        red\or%
        orange\or%
        green\or%
        purple\or%
        brown\or%
        teal\or%
        yellow\else%
        headercolor\fi%
    } #1#2#3%
  }%
  \stepcounter{colorCounter}%
}
\ifdefined\@cv@print
  \colorlet{green}{gray}
  \colorlet{orange}{gray}
  \colorlet{purple}{gray}
  \colorlet{brown}{gray}
  \colorlet{red}{gray}
  \colorlet{blue}{gray}
  \colorlet{teal}{gray}
  \colorlet{yellow}{gray}
  \colorlet{fillheader}{white}
  \colorlet{header}{gray}
\else
  \colorlet{fillheader}{gray}
  \colorlet{header}{white}
\fi
\makeatother

O código:

\documentclass[]{friggeri-cv} % Add 'print' as an option into the square bracket to remove colors from this template for printing

\addbibresource{bibliography.bib} % Specify the bibliography file to include publications

\definecolor{teal}{HTML}{008080}
\definecolor{yellow}{HTML}{FFFF00}

\makeatletter
\def\@sectioncolor#1#2#3{%
  {%
    \color{%
      \ifcase\value{colorCounter}%
        blue\or%
        red\or%
        orange\or%
        green\or%
        purple\or%
        brown\or%
        teal\or%
        yellow\else%
        headercolor\fi%
    } #1#2#3%
  }%
  \stepcounter{colorCounter}%
}
\ifdefined\@cv@print
  \colorlet{green}{gray}
  \colorlet{orange}{gray}
  \colorlet{purple}{gray}
  \colorlet{brown}{gray}
  \colorlet{red}{gray}
  \colorlet{blue}{gray}
  \colorlet{teal}{gray}
  \colorlet{yellow}{gray}
  \colorlet{fillheader}{white}
  \colorlet{header}{gray}
\else
  \colorlet{fillheader}{gray}
  \colorlet{header}{white}
\fi
\makeatother

\begin{document}

\header{john}{smith}{junior business analyst} % Your name and current job title/field

%----------------------------------------------------------------------------------------
%   SIDEBAR SECTION
%----------------------------------------------------------------------------------------

\begin{aside} % In the aside, each new line forces a line break
\section{contact}
123 Broadway
City, State 12345
Country
~
+0 (000) 111 1111
+0 (000) 111 1112
~
\href{mailto:[email protected]}{[email protected]}
\href{http://www.smith.com}{http://www.smith.com}
\href{http://facebook.com/johnsmith}{fb://jsmith}
\section{languages}
english mother tongue
spanish \& italian fluency
\section{programming}
{\color{red} $\varheartsuit$} JavaScript
Python, C++, PHP
CSS3 \& HTML5
\end{aside}

\section{education}

\section{experience}

\section{awards}

\section{communication skills}

\section{interests}

\section{publications}

\section{another section}

\section{yet another section}

\end{document}

A saída:

insira a descrição da imagem aqui

Se quiser fazer a modificação no .cls file, então faça uma cópia do friggeri-cv.cls, salve como myfiggeri-cv.cls, e neste novo arquivo altere as linhas

\ProvidesClass{friggeri-cv}[2012/04/30 CV class]

para

\ProvidesClass{myfriggeri-cv}[2012/04/30 CV class]

próxima mudança

\ifdefined\@cv@print
  \colorlet{green}{gray}
  \colorlet{orange}{gray}
  \colorlet{purple}{gray}
  \colorlet{brown}{gray}
  \colorlet{red}{gray}
  \colorlet{blue}{gray}
  \colorlet{fillheader}{white}
  \colorlet{header}{gray}
\else
  \colorlet{fillheader}{gray}
  \colorlet{header}{white}
\fi

para

\definecolor{teal}{HTML}{008080}
\definecolor{yellow}{HTML}{FFFF00}

\ifdefined\@cv@print
  \colorlet{green}{gray}
  \colorlet{orange}{gray}
  \colorlet{purple}{gray}
  \colorlet{brown}{gray}
  \colorlet{red}{gray}
  \colorlet{blue}{gray}
  \colorlet{teal}{gray}
  \colorlet{yellow}{gray}
  \colorlet{fillheader}{white}
  \colorlet{header}{gray}
\else
  \colorlet{fillheader}{gray}
  \colorlet{header}{white}
\fi

e finalmente, mude

\def\@sectioncolor#1#2#3{%
  {%
    \color{%
      \ifcase\value{colorCounter}%
        blue\or%
        red\or%
        orange\or%
        green\or%
        purple\or%
        brown\else%
        headercolor\fi%
    } #1#2#3%
  }%
  \stepcounter{colorCounter}%
}

para

\def\@sectioncolor#1#2#3{%
  {%
    \color{%
      \ifcase\value{colorCounter}%
        blue\or%
        red\or%
        orange\or%
        green\or%
        purple\or%
        brown\or%
        teal\or%
        yellow\else%
        headercolor\fi%
    } #1#2#3%
  }%
  \stepcounter{colorCounter}%
}

salve as alterações e coloque-as myfriggeri-cv.clsem algum lugar que o TeX possa encontrá-las (o mais fácil é o diretório de trabalho atual); no seu .texdocumento agora você diz

\documentclass{myfriggeri-cv}

informação relacionada