\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}

\renewcommand*\l@section
{%
\helvbx\color{MainColor}\bfseries
\def\@linkcolor{MainColor}\@dottedtocline{1}{1.5em}{1.5em}
}

\renewcommand*\l@subsection
{%
\helvbx\color{green!50!black}
\def\@linkcolor{green!50!black}
\@dottedtocline{1}{2.3em}{2.6em}
}

\renewcommand*\l@subsubsection
{%
\helvbx\color{orange!80!black}
\def\@linkcolor{orange!80!black}
\@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{MainColor}}
{\fcolorbox{red!50!black}{MainColor}{\textcolor{white}{\bfseries\thesection}}}
{1em}
{\helvbx}

\titleformat{\subsection}[block]
{\helvbx\large\color{green!50!black}}
{\thesubsection}
{1em}
{\helvbx}

\titleformat{\subsubsection}[block]
{\helvbx\large\color{orange!50!black}}
{\thesubsubsection}
{1em}
{\helvbx}

\makeatother