Like this, which is basically a combination of this: https://tex.stackexchange.com/a/568900/118712 and this: https://tex.stackexchange.com/a/389833/118712
I also added some modifications for your re-naming of the toc and bib chapter titles.
\documentclass[12pt,a4paper,listof=totocnumbered]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage[width=17.00cm, height=23.00cm]{geometry}
\usepackage{setspace} \renewcommand{\baselinestretch}{1.5}
\usepackage{times}
\usepackage{tikz}
\addto\captionsfrench{\renewcommand{\bibname}{Références bibliographiques}}
\addto\captionsfrench{\renewcommand{\contentsname}{Sommaire}}
\usepackage[most]{tcolorbox}
\makeatletter
\renewcommand*{\chapterlinesformat}[3]{%
\tcbox[on line, boxsep=4pt,left=4pt,right=0pt,top=0pt,bottom=0pt,colframe=blue,colback=cyan!26,arc=5mm]{
\parbox{\dimexpr\linewidth-2\fboxsep}{\raggedchapter
@hangfrom{\strut#2}{#3}%
}%
}%
}
\renewcommand*{\sectionlinesformat}[4]{%
\tcbox[on line, boxsep=4pt,left=4pt,right=0pt,top=0pt,bottom=0pt,colframe=green,colback=red,arc=5mm]{%
\parbox{\dimexpr\linewidth-2\fboxsep-2\fboxrule}{\raggedsection
@hangfrom{\strut\hskip #2#3}{#4}%
}%
}%
}
\makeatother
\begin{document}
\tableofcontents
\addchap[Introduction generale]{\scshape Introduction}
\addsec{I -- contexte et justification }
\addsec{objectifs}
\chapter{début}
\section{title}
\end{document}

%and put\usepackage{xcolor}. If you could make a full minimal working example (MWE) then you will be more likely to get help. – Willoughby Jun 14 '21 at 16:48