%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Spider CV
% LaTeX Class
% Version 1.1 (08/10/22)
%
% Name like this because of the spider chart widget.
% 
% Authors:
% ROMAINPC
% Inspired by developercv (Jan Vorisek)
% Inspired by developercv Doji variant (Stijn Dejongh)
% Inspired by limecv (Olivier Pieters)
% Inspired by altacv (LianTze Lim)
%
% License:
% The MIT License (see included LICENSE file)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{spidercv}[03/01/2022]

\DeclareOption*{\PassOptionsToClass{\CurrentOption}{extarticle}} % Pass through any options to the base class
\ProcessOptions\relax % Process given options

\LoadClass{extarticle} % Load the baspidercvse class

%----------------------------------------------------------------------------------------
%	PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------

\setlength{\parindent}{0mm} % Suppress paragraph indentation
\usepackage[hidelinks]{hyperref} % Required for links but hide the default boxes around links
\newcommand{\lorem}{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus.} % Dummy text
\pagestyle{empty} % No headers or footers
\usepackage{moresize} % Provides more font size commands (\HUGE and \ssmall)
\usepackage{fontawesome} % fontawesomspidercv----------------------------------------------------
\usepackage[dvipsnames]{xcolor}

\definecolor{Black}{HTML}{212121}
\definecolor{White}{HTML}{FFFFFF}
\definecolor{GreenArmy}{HTML}{252e25}
\definecolor{GreenIT}{HTML}{4caf50}

%%%%% color macros, use it at the beginning of your cv to quickly use the enterprise colors (Pro HRD tips)
\newcommand{\DefineColorMacros}[5]{% COLORS : TextSide / TextMain / HighLight / Background /Other
    \def\ColorTextSide{#1}
    \def\ColorTextMain{#2}
    \def\ColorHighlight{#3}
    \def\ColorBackground{#4}spidercv
%----------------------------------------------------------------------------------------
%	Printable mode
%----------------------------------------------------------------------------------------
\newcommand{\PrintableMode}{
    \def\PM{} % PM command used in if statements
    \def\ColorTextSide{\ColorTextMain} % Use same text color everywhere
}


%----------------------------------------------------------------------------------------
%	FONTS
%----------------------------------------------------------------------------------------

\usepackage[utf8]{inputenc} % Required for inputting international characters
\usepackage[T1]{fontenc} % Output font encoding for international characters

% \usepackage{roboto}
\usepackage[scaled]{helvet}


\renewcommand*\familydefault{\sfdefault} % Force the sans-serif version of any font used



%----------------------------------------------------------------------------------------
%	GEOMETRIE
%----------------------------------------------------------------------------------------
\usepackage{calc}
\usepackage{tikz}
\usetikzlibrary{calc,positioning,backgrounds,matrix}

\newlength\margin
\setlength\margin{0.5cm}
\usepackage[margin=\margin,noheadfoot,a4paper]{geometry}
\newlength\sidewidth
\setlength\sidewidth{0.33333\paperwidth-2\margin}
\newlength\mainwidth
\setlength\mainwidth{\paperwidth-4\margin-\sidewidth}
\newlength\anglesize
\setlength\anglesize{0.7cm}
\newlength\topheight
\setlength\topheight{\sidewidth}
\newlength\profilesize
\setlength\profilesize{0.7\topheight}




%----------------------------------------------------------------------------------------
%	MAIN SECTIONS
%----------------------------------------------------------------------------------------

\usepackage{ragged2e}
\usepackage[absolute,overlay]{textpos} % option needed to use absolute positionning and to have text on front

\newenvironment{SideBar}[2]{% Background color, Text color
    \begin{tikzpicture}[remember picture,overlay]% put text anywhere

        \ifx\PM\undefined % side and top background
        \fill[fill=#1, shift={(current page.north west)}] 
        \else
        \draw[draw=#1, shift={(current page.north west)}, very thick]
        \fi
            % \fill[fill=#1, shift={(current page.north west)}] 
            (0,-\paperheight) --
            (0,-\anglesize) --
            (\anglesize,0) --
            (\paperwidth,0) --
            (\paperwidth,-\topheight-2\margin) --
            (\sidewidth+2\margin+\anglesize,-\topheight-2\margin) --
            (\sidewidth+2\margin,-\topheight-2\margin-\anglesize) --
            (\sidewidth+2\margin,-\paperheight) --
            cycle;
        \draw [draw=#1, shift={(current page.north west)}, very thick]
            (\paperwidth-0.5\margin,-\topheight-3\margin) --
            (\paperwidth-0.5\margin,-\paperheight+0.5\margin+0.5\anglesize) --
            (\paperwidth-0.5\margin-0.5\anglesize,-\paperheight+0.5\margin) --
            (\sidewidth+3\margin,-\paperheight+0.5\margin);
    \end{tikzpicture}%
    %%%%%%%%%%%%%
    % \TPmargin{}{}
    \begin{textblock*}{\sidewidth}(\margin,\topheight + 3\margin -0.4cm)
    \begin{center}
    \color{#2}
    % Please use vspace to verticaly align manually your content
}{
    \end{center}
    \end{textblock*}
}


\newenvironment{TopBar}[1]{ % Text color
    \begin{textblock*}{\mainwidth}(\sidewidth+3\margin,\margin-0.4cm)
    \begin{center}
    \color{#1}
}{
    \end{center}
    \end{textblock*}
}


\newenvironment{MainPart}{
    \begin{textblock*}{\mainwidth}(\sidewidth+3\margin,\topheight + 3\margin-0.4cm)
    \begin{center}
}{
    \end{center}
    \end{textblock*}
}


\usetikzlibrary{shapes,decorations}

%%%%%%% Picture
\newcommand{\DefineProfile}[3]% Background color, Highlight color, Img path
{   
    \begin{tikzpicture}[remember picture,overlay]
        \node [rectangle, draw=#2, rounded corners=0.5mm, very thick,
        shift={(current page.north west)}, xshift=\anglesize, yshift=-\anglesize,
        ](s1){};
        \node [rectangle, draw=#2, rounded corners=0.5mm, very thick,
        shift={(current page.north west)}, xshift=(\sidewidth+2\margin), yshift=-(\sidewidth+2\margin),
        ](s2){};
        \draw [draw=#2, very thick]
        (s1) -- (s2);
        %%%%%%%%%%%%%%%
        \def\backcolor{\ifx\PM\undefined#1\else White\fi}
        \node[
            shift={(current page.north west)},
            xshift=(\sidewidth+2\margin)/2,
            yshift=-(\sidewidth+2\margin)/2,
            chamfered rectangle, draw=#2, very thick,
          minimum size=\profilesize,
          fill=\backcolor,
          path picture={
            \node at (path picture bounding box.center){
            \includegraphics[height=\profilesize]{#3}
            };
          }]
          {};
      \end{tikzpicture}
}



%----------------------------------------------------------------------------------------
%	COMMANDS AND ENVIRONMENTS
%----------------------------------------------------------------------------------------

%%%%%%% Top bar

%%% Name
\newcommand{\Name}[4]% Highlight color, Name, Profession, Age
{
    {\HUGE{\textbf{\color{#1}#2}}\\
    \Large{#3}
    \hfill
    \Large{#4}}
}

%%%%%%%%% Side bar

%%% Spider chart
\usepackage{xparse}
\newcounter{spidercount}
\ExplSyntaxOn
\NewDocumentCommand{\newList}{m}
 {
  \seq_new:c { l_kees_list_#1_seq }
 }