\documentclass[12pt,a4paper,twoside]{report}
%====En-tête====
% Ajout des packages
\usepackage[french,english]{babel} % pour dire que le texte est en francais
\usepackage{csquotes}
\usepackage{a4} % pour la taille
\usepackage[T1]{fontenc} % pour les font postscript
\usepackage[cyr]{aeguill} % Police vectorielle TrueType, guillemets francais
\usepackage{epsfig} % pour gérer les images
\usepackage{amsmath,amsthm, mathtools} % très bon mode mathématique
\usepackage{amsfonts,amssymb,bm, bbold}% permet la definition des ensembles
\usepackage{algorithm2e} % pour les algorithmes
\usepackage{algpseudocode} % pour les algorithmes
\usepackage{float} % pour le placement des figure
\usepackage{url} % pour une gestion efficace des url
\usepackage[citecolor=blueind,urlcolor=blueps,bookmarks=false,hypertexnames=true]{hyperref}  % pour les hyperliens dans le document
\usepackage{tocbibind} % Pour avoir des index pour table des matières, biblio
\usepackage{geometry}
\usepackage{tikz} % For graph plots
\usepackage[outline]{contour}
\usepackage[super]{nth}


\usepackage{caption} % Figures
\usepackage{subcaption} % And Subfigures


\usepackage{longtable}
\usepackage{colortbl}

\usepackage{titling}

\usepackage{rotating} % For allowing to rotate figures
\usepackage{float} % To allow Pandoc to control figure placement
\usepackage{booktabs} % For good tables

% FancyHDR
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\chaptermark}[1]{\markboth{#1}{#1}}
\fancyhead[lo]{\slshape\nouppercase{\rightmark}}
\fancyhead[re]{\slshape\nouppercase{\leftmark}}
\fancyhead[ro,le]{\thepage}

\fancypagestyle{intro}{%
    \fancyhf{}
    \fancyfoot[C]{\thepage}
    \renewcommand{\headrulewidth}{0pt}
    \renewcommand{\footrulewidth}{0pt}
}


% Images
\graphicspath{{img/}}

% Figure placement
\floatplacement{figure}{H}

%% Tikz Related
\usetikzlibrary{calc,shapes,backgrounds,arrows,automata,shadows,positioning,
arrows,shapes,positioning,shadows,trees,calc,backgrounds,
automata,positioning}


% Couleurs
%% Couleur Paris-Saclay
\definecolor{pruneps}{RGB}{99,0,60}
\definecolor{bluefonceps}{RGB}{0,78,125}
\definecolor{blueps}{RGB}{14,135,201}
\definecolor{cyanps}{RGB}{70,195,210}
\definecolor{vertps}{RGB}{64,183,105}

% Pour la biblio
\usepackage[style=apa, sorting=none, backend=biber]{biblatex}
\addbibresource{references.bib}
\AtEveryCite{\color{bluefonceps}}

% Pour avoir les chapitres stylés
\newcounter{customchapter}

% Pour arrêter de colorer après le contenu principal
\newcounter{maincontentend}


% Important : modifie ici le nombre de chapitres que tu as.
% A savoir que cela correspond aux nombres de labels du bandeau sur le côté.
% Le bandeau est automatiquement mis à jour pour correspondre à la valeur de la 
% variable customchapter, avec 0 = pas de label.
\newcommand\ChapNum{5}

%%%%%% Debut code onglets

\usepackage{background}
\usepackage{changepage}
\usepackage{sectsty}
\newcommand\DeactivateBG{\backgroundsetup{contents={}}}
\newcommand\ActivateBG{\backgroundsetup{
		scale=1,
		angle=0,
		opacity=0.5,
		contents={
            \ifnum\value{maincontentend}=0
			\ifnum\value{customchapter}>0
			\checkoddpage
			\ifoddpage
			\begin{tikzpicture}[remember picture,overlay]
			\node[rotate=90,minimum width=\paperheight,minimum height=0.5cm,fill=gray!40,font=\large\bfseries,text=white,anchor=south west] at ($(current page.south east)$) {};
			\node[rotate=90,minimum width=1/\ChapNum*\paperheight,minimum height=0.5cm,fill=\BoxColor,font=\large\bfseries,text=white,anchor=south west] at ([yshift=(\ChapNum-\thecustomchapter)/\ChapNum*\paperheight]$(current page.south east)$) {\chaptername~\thechapter}; 
			\end{tikzpicture}
			\else
			\begin{tikzpicture}[remember picture,overlay]
			\node[rotate=90,minimum width=\paperheight,minimum height=0.5cm,fill=gray!40,font=\large\bfseries,text=white,anchor=south west] at ([xshift=-\paperwidth+0.5cm]$(current page.south east)$) {};
			\node[rotate=270,minimum width=1/\ChapNum*\paperheight,minimum height=0.5cm,fill=\BoxColor,font=\large\bfseries,text=white,anchor=south west] at ([yshift=(\ChapNum-\thecustomchapter+1)/\ChapNum*\paperheight,xshift=-\paperwidth]$(current page.south east)$) {\chaptername~\thechapter};
			\end{tikzpicture}
			\fi
            \fi
			\fi
}
}
}

\definecolor{bleuvert}{RGB}{102, 255, 204}
\definecolor{greenAgro}{HTML}{028887}
\newcommand\BoxColor{%
	\ifcase\thecustomchapter greenAgro!40!black\or green!40!black\or blue!40!black\or  orange!70!black\or violet!60!black\or teal!60!black\or red!40!black\or blue!40!black\else greenAgro!40!black
    \fi}
% \newcommand\ChapterTitle{%
% 	\ifcase\thecustomchapter {\thechapter} \else {}
%     \fi
%     }

\sectionfont{\color{\BoxColor}}
\subsectionfont{\color{\BoxColor}}
\subsubsectionfont{\color{\BoxColor}}

%%%% End onglets

%%%%%%%%%%%%%% En-tête de chapitre %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\makeatletter
\def\thickhrulefill{\leavevmode \leaders \hrule height 1ex \hfill \kern \z@}
\def\@makechapterhead#1{%
	\vspace*{-30\p@}%
	{
		\parindent \z@ \raggedleft \reset@font
		\scshape 
		\color{\BoxColor}{\@chapapp{} {\fontsize{100pt}{12pt}\selectfont{\textbf{\thechapter}}}}
		\par\nobreak
		\interlinepenalty\@M
		\Huge \bfseries {\color{\BoxColor}{#1}}\par\nobreak
		\vspace*{-20\p@}%
		{\color{\BoxColor}\hrulefill}
		\par\nobreak
		\vskip 10\p@
}}
\def\@makeschapterhead#1{%
	\vspace*{-30\p@}%
	{
		\parindent \z@ \raggedleft \reset@font
		\scshape \vphantom{\@chapapp{} \thechapter}
		\par\nobreak
		\interlinepenalty\@M
		\Huge \bfseries {\color{\BoxColor}{#1}}\par\nobreak
		\vspace*{-20\p@}%
		\hrulefill
		\par\nobreak
		\vskip 10\p@
}}
\makeatother

% Nouvelles commandes
\newcommand{\Tau}{\mathcal{T}}
\newcommand{\eps}[1][]{\ensuremath{\epsilon_{#1}}}


% titre et auteur
\title{Un titre qui claque}
\author{Un.e auteur.e}
\begin{document}

% Pour désactiver le fond (background)
\DeactivateBG
\include{page-garde}
% Pour activer les onglets
\ActivateBG
\begin{selectlanguage}{french}
	% \maketitle
	\pagenumbering{roman}
	\tableofcontents
	\include{remerciements}
	\include{intro}
\end{selectlanguage}

\begin{selectlanguage}{english}
	\pagenumbering{arabic}
	\include{chapter1}

	\include{chapter2}


	% On marque la fin du contenu principal
	\addtocounter{maincontentend}{1}
	% On incrémente le compteur pour changer de couleurs quand même
	\addtocounter{customchapter}{1}
	\printbibliography
\end{selectlanguage}
\begin{selectlanguage}{french}
	\listoffigures
	\listoftables
\end{selectlanguage}

\end{document}
