%% start of file `moderncvthemecustom.sty'.
%% Copyright 2011 Alexis Lahouze (xals@lahouze.org).
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License version 1.3c,
% available at http://www.latex-project.org/lppl/.


%-------------------------------------------------------------------------------
%                identification
%-------------------------------------------------------------------------------
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{moderncvthemecustom}[2011/08/03 v0.1 custom curriculum vitae style: custom]


%-------------------------------------------------------------------------------
%                required packages
%-------------------------------------------------------------------------------


%-------------------------------------------------------------------------------
%                package options
%-------------------------------------------------------------------------------
% color options
% blue (default option)
\DeclareOption{blue}{}
% orange
\newif\if@colororange\@colororangefalse
\DeclareOption{orange}{\@colororangetrue}
% green
\newif\if@colorgreen\@colorgreenfalse
\DeclareOption{green}{\@colorgreentrue}
% red
\newif\if@colorred\@colorredfalse
\DeclareOption{red}{\@colorredtrue}
% grey
\newif\if@colorgrey\@colorgreyfalse
\DeclareOption{grey}{\@colorgreytrue}

% unused options
\DeclareOption*{
  \PackageWarning{moderncvthemecustom}{Unknown option ‘\CurrentOption’}}

% execute default options
\ExecuteOptions{color}

% process given options
\ProcessOptions\relax


%-------------------------------------------------------------------------------
%                style definition
%-------------------------------------------------------------------------------
% symbols used

% colors
\definecolor{firstnamecolor}{rgb}{0,0,0}
\definecolor{familynamecolor}{rgb}{0,0,0}
\definecolor{titlecolor}{rgb}{0.35,0.35,0.35}
\definecolor{quotecolor}{rgb}{0.35,0.35,0.35}
\definecolor{addresscolor}{rgb}{0.35,0.35,0.35}
% default blue color
  \definecolor{sectionrectanglecolor}{rgb}{0.25,0.50,0.75}
  \definecolor{sectiontitlecolor}{rgb}{0.20,0.40,0.65}
  \definecolor{subsectioncolor}{rgb}{0.20,0.40,0.65}
  \definecolor{footersymbolcolor}{rgb}{0.25,0.50,0.75}
\if@colororange
  \definecolor{sectionrectanglecolor}{rgb}{1.00,0.65,0.20}
  \definecolor{sectiontitlecolor}{rgb}{0.95,0.55,0.15}
  \definecolor{subsectioncolor}{rgb}{0.95,0.55,0.15}
  \definecolor{footersymbolcolor}{rgb}{0.95,0.55,0.15}\fi
\if@colorgreen
  \definecolor{sectionrectanglecolor}{rgb}{0.55,0.85,0.35}
  \definecolor{sectiontitlecolor}{rgb}{0.30,0.65,0.15}
  \definecolor{subsectioncolor}{rgb}{0.30,0.65,0.15}
  \definecolor{footersymbolcolor}{rgb}{0.30,0.65,0.15}\fi
\if@colorred
  \definecolor{sectionrectanglecolor}{rgb}{1.00,0.30,0.30}
  \definecolor{sectiontitlecolor}{rgb}{0.95,0.20,0.20}
  \definecolor{subsectioncolor}{rgb}{0.95,0.20,0.20}
  \definecolor{footersymbolcolor}{rgb}{0.95,0.20,0.20}\fi
\if@colorgrey
  \definecolor{sectionrectanglecolor}{rgb}{0.75,0.75,0.75}
  \definecolor{sectiontitlecolor}{rgb}{0.35,0.35,0.35}
  \definecolor{subsectioncolor}{rgb}{0.35,0.35,0.35}
  \definecolor{footersymbolcolor}{rgb}{0.35,0.35,0.35}\fi


%\definecolor{sectionrectanglecolor}{rgb}{0.75,0.75,0.75}
%\definecolor{sectionrectanglecolor}{rgb}{0.55,0.85,0.35}
%\definecolor{sectiontitlecolor}{rgb}{0.35,0.35,0.35}
%\definecolor{sectiontitlecolor}{rgb}{0.30,0.65,0.15}
%\definecolor{subsectioncolor}{rgb}{0.35,0.35,0.35}
%\definecolor{subsectioncolor}{rgb}{0.30,0.65,0.15}
%\definecolor{footersymbolcolor}{rgb}{0.30,0.65,0.15}



% fonts
\renewcommand*{\ttdefault}{phv} % Arial
\renewcommand*{\rmdefault}{phv} % Arial
\renewcommand*{\sfdefault}{phv} % Arial
\renewcommand*{\firstnamefont}{\huge\sffamily\mdseries\upshape}
\renewcommand*{\titlefont}{\LARGE\sffamily\mdseries\slshape}
\renewcommand*{\addressfont}{\small\rmfamily\mdseries\slshape}
\renewcommand*{\familynamefont}{\firstnamefont}
\renewcommand*{\quotefont}{\large\slshape}
\renewcommand*{\sectionfont}{\Large\sffamily\mdseries\upshape}
\renewcommand*{\subsectionfont}{\large\sffamily\mdseries\upshape}

% styles

% maketitle
%   setmaketitlenamemaxwidth to the full name length, capped by \maketitlenamemaxwidth
\newlength{\maketitlenamemaxwidth}
\setlength{\maketitlenamemaxwidth}{.525\textwidth}
\newlength{\maketitlenamefullwidth}
\settowidth{\maketitlenamefullwidth}{\firstnamestyle{\@firstname~}\familynamestyle{\@familyname}}
%   other lengths
\newlength{\maketitlepicturewidth}
\setlength{\maketitlepicturewidth}{\@photowidth}
\newlength{\maketitledetailswidth}
%   recompute theme-specific lengths, called by class to recompute all lengths
\renewcommand*{\recomputethemelengths}{%
  \setlength{\maketitledetailswidth}{\textwidth}%
  \ifthenelse{\lengthtest{\maketitlepicturewidth=0pt}}%
  	{}%
  	{\addtolength{\maketitledetailswidth}{-\separatorcolumnwidth}%
  	\addtolength{\maketitledetailswidth}{-\maketitlepicturewidth}}}
\recomputethemelengths
\newif\if@firstdetailselement\@firstdetailselementtrue
\newcommand*{\maketitledetailsnewline}{
  \if@firstdetailselement%
    \@firstdetailselementfalse%
  \else%
    \\[.2em]\fi}
\newcommand*{\logo}[2]{
  \\[0.5em]\includegraphics[height=#2]{#1}
}

\renewcommand*{\maketitle}{%
  % name and title
  \begin{minipage}[t]{\maketitledetailswidth}%
    \raggedright\firstnamestyle{\@firstname~}\familynamestyle{\@familyname}\\[1em]%
    \addressfont\color{addresscolor}%
    \ifthenelse{\isundefined{\@addressstreet}}{}{%
      \@addressstreet%
      \ifthenelse{\isundefined{\@addresscity}}{}{\\\@addresscity\\[1em]}}%
    \ifthenelse{\isundefined{\@mobile}}{}{\maketitledetailsnewline\mobilesymbol~\@mobile}%
    \ifthenelse{\isundefined{\@phone}}{}{\maketitledetailsnewline\phonesymbol~\@phone}%
    \ifthenelse{\isundefined{\@fax}}{}{\maketitledetailsnewline\faxsymbol~\@fax}%
    \ifthenelse{\isundefined{\@email}}{}{\maketitledetailsnewline\emailsymbol~\emaillink{\@email}}%
    \ifthenelse{\isundefined{\@homepage}}{}{\maketitledetailsnewline\homepagesymbol~\httplink{\@homepage}}%
    \ifthenelse{\isundefined{\@extrainfo}}{}{\\[1em]\@extrainfo}%
    % optional quote
    \ifthenelse{\isundefined{\@quote}}%
      {}%
      {{\\[1.5em]\centering{}\begin{minipage}{\maketitledetailswidth}\flushright\quotestyle{\@quote}\end{minipage}}}%
  \end{minipage}%
  % optional photo
  \ifthenelse{\isundefined{\@photo}}%
    {}%
    {%
      \hspace*{\separatorcolumnwidth}%
      \begin{minipage}[t]{\maketitlepicturewidth}%
        \raggedleft{}\addressfont\color{addresscolor}%  required to correctly align content
        \framebox{\includegraphics[width=\maketitlepicturewidth]{\@photo}}%
      \end{minipage}}\\[1.5em]%
  % title
  \ifthenelse{\isundefined{\@title}}%
    {}%
    {{\centering{}\begin{minipage}{\quotewidth}\centering\titlestyle{\@title}\end{minipage}\\[1.25em]}}%
  }


\endinput


%% end of file `moderncvthemecustom.sty'.
