\makeatletter

\def\@dottedtocline#1#2#3#4#5{%
  \ifnum #1>\c@tocdepth \else
    \vskip \z@ \@plus.2\p@
    {\leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip
     \parindent #2\relax\@afterindenttrue
     \interlinepenalty\@M
     \leavevmode
     \@tempdima #3\relax
     \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
     {#4}\nobreak
     \leaders\hbox{$\m@th
        \mkern \@dotsep mu\hbox{.}\mkern \@dotsep
        mu$}\hfill
     \nobreak
     \hb@xt@\@pnumwidth{\hfil\helvbx #5}%
     \par}%
  \fi}
  
  
\definecolor{sectioncolor}{HTML}{335ca3}
\renewcommand*\l@section
{%
\helvbx\color{sectioncolor}\bfseries
\def\@linkcolor{sectioncolor}\@dottedtocline{1}{1.5em}{1.5em}
}

\definecolor{subsectioncolor}{HTML}{f28300}
\renewcommand*\l@subsection
{%
\helvbx\color{subsectioncolor}
\def\@linkcolor{subsectioncolor}
\@dottedtocline{1}{2.3em}{2.6em}
}

\definecolor{subsubsectioncolor}{HTML}{7b7a78}
\renewcommand*\l@subsubsection
{%
\helvbx\color{subsubsectioncolor}
\def\@linkcolor{subsubsectioncolor}
\@dottedtocline{1}{3em}{3.3em}
}

\def\contentsline#1#2#3#4{%
  \ifx\\#4\\%
    \csname l@#1\endcsname{#2}{#3}%
  \else
      \csname l@#1\endcsname{\hyper@linkstart{link}{#4}{#2}\hyper@linkend}{%
        \hyper@linkstart{link}{#4}{#3}\hyper@linkend
      }%
  \fi
}

% --------------------
% TITRES DES SECTIONS 
% --------------------

\titleformat{\section}[block]
{\helvbx\Large\color{sectioncolor}}
{\fcolorbox{sectioncolor}{sectioncolor}{\textcolor{white}{\bfseries\thesection}}}
{2mm}
{\helvbx}

\titleformat{\subsection}[block]
{\helvbx\large\color{subsectioncolor}}
{\thesubsection}
{2mm}
{\helvbx}

\titleformat{\subsubsection}[block]
{\helvbx\large\color{subsubsectioncolor}}
{\thesubsubsection}
{2mm}
{\helvbx}

\makeatother

\newcommand{\helvbx}{\usefont{T1}{phv}{m}{n}}