% Packages
\RequirePackage[left=2cm, right=2cm, top=2cm, bottom=3cm]{geometry}
\RequirePackage{fontawesome}
\RequirePackage{xcolor}
\usepackage{float}
\usepackage[french]{babel}
\usepackage{fancyhdr}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{array}
\usepackage{pdfpages}
\usepackage[explicit]{titlesec}
\usepackage{soul}
\usepackage[
    labelfont={small,bf,color=LightGrey},
    textfont={small,color=SlateGrey}
]{caption}
\usepackage{listings}
\lstset{
    basicstyle=\ttfamily\footnotesize,
    breaklines=true
}
\usepackage{calrsfs}

\renewcommand{\FrenchLabelItem}{\textbullet}
\pagestyle{fancy}

\renewcommand{\headrulewidth}{0pt}
\renewcommand{\arraystretch}{1.4}
% OPTIONS

% Captions
%\captionsetup[table]{name=tableau}
\captionsetup[figure]{name=figure}

% Graphx
\graphicspath{ {./images/} }

% Colors and fonts
\definecolor{ElectricMagenta}{HTML}{F268B3}
\definecolor{ElectricGreen}{HTML}{1CD180}
\definecolor{SlateGrey}{HTML}{2E2E2E}
\definecolor{LightGrey}{HTML}{CCCCCC}
\definecolor{UltraLightGrey}{HTML}{EFEFEF}
\definecolor{Black}{HTML}{000000}
\setulcolor{ElectricMagenta}
\usepackage[default]{lato}
% Fonts
\setmainfont[
  BoldFeatures={SizeFeatures={Size=8}},
  ItalicFeatures={SizeFeatures={Size=8}},
  SizeFeatures={Size=8}
]{Lato}
% \setmonofont{FiraCode-Regular}
\newfontfamily\quotefont[SizeFeatures={Size=10}]{Linux Libertine O}


\AtBeginEnvironment{quote}{%
    \vspace{-15pt} % Reduce space above the quote
}
\newcommand*\openquote{\makebox(30,-30){\scalebox{3}{\flqq{}}}}
\newcommand*\closequote{\makebox(30,0){\scalebox{3}{\frqq{}}}}

% Quote
\AtBeginEnvironment{quote}{\color{LightGrey}\large\quotefont\openquote\color{SlateGrey}}
\AtEndEnvironment{quote}{\color{LightGrey}\closequote}

% figures
\AtEndEnvironment{figure}{%
    \color{ElectricMagenta}\noindent\rule{\textwidth}{0.4pt}
}
\AtEndEnvironment{table}{%
    \color{ElectricMagenta}\noindent\rule{\textwidth}{0.4pt}
}
\AfterEndEnvironment{lstlisting}{%
    {\color{ElectricMagenta}\noindent\rule{\textwidth}{0.4pt}}
}

\BeforeBeginEnvironment{itemize}{%
    \vspace{5pt}
}

% Code
\lstset{
    backgroundcolor=\color{UltraLightGrey},
    captionpos=b,
    numbers=left,
    xleftmargin=5pt,
    xrightmargin=5pt,
    frame=single,
    framesep=5pt,
    rulecolor=\color{UltraLightGrey},
    keywordstyle=\color[rgb]{0,0,1},
    commentstyle=\color[rgb]{0.133,0.545,0.133},
    stringstyle=\color[rgb]{0.627,0.126,0.941},
}

  % Hyperlink
\usepackage[hidelinks]{hyperref}
\newcommand{\link}[2]{
    \href{#1}{\ul{{\color{ElectricGreen}\faLink} #2}}
}

%\newcommand{\link}[2]{
%    {\ul{{\color{ElectricGreen}\faLink} #2}
%    \footnote{\ul{{\color{ElectricGreen}\faLink} #1}}}
%}

% Paragraph ...
\parindent=0em
\renewcommand{\baselinestretch}{1.2}

% pagehead, pagefoot
\fancyhead[LE]{\footnotesize\color{SlateGrey}Yorick Barbanneau}
\fancyhead[RO]{\footnotesize\color{SlateGrey}Introduction à la vérification}
\fancyhead[LO]{\footnotesize\color{SlateGrey}Yorick Barbanneau}
\fancyhead[RE]{\footnotesize\color{SlateGrey}Introduction à la vérification}


% chapter titles
%\titleformat{hcommand}[hshape]{format}{label}{sep}{before-code}[after-code]
\titleformat{\chapter}[display]{}{
    \Large\color{ElectricMagenta}\chaptertitlename\ \thechapter~
    \huge\color{Black}\textbf{#1}
}{0pt}{}[]

\titleformat{name=\chapter, numberless}[display]{}{
    %\Large\color{ElectricMagenta}\chaptertitlename\ \thechapter~
    \huge\color{Black}\textbf{#1}
}{0pt}{}[]

\titleformat{\section}
{\normalfont\large\bfseries}{\thesection}{1em}{#1}

\titleformat{\subsection}
  {\normalfont\normalsize\bfseries}{\thesubsection}{1em}{#1}

\titlespacing{\section}{0pt}{7pt}{5pt}
\titlespacing{\subsection}{0pt}{7pt}{2pt}
