Color background for chapter titles which stretches horizontally to the margins
Here a suggestion using mdframed
. I also removed the package tocloft
which isn't needed.
\documentclass[12pt,a4paper,
% Add lists to TOC
listof=numbered,numbers=noenddot,version=first,
]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\inputencoding{utf8}
\usepackage{helvet}
\usepackage{mathpazo}
\usepackage{setspace, lipsum}
\usepackage{xcolor}
\usepackage{mdframed}
\mdfdefinestyle{chapter}{rightmargin=-3cm,innerrightmargin=3cm,backgroundcolor=red,hidealllines=true}
\addtokomafont{chapter}{\color{white}}
\makeatletter
\renewcommand*{\@@makechapterhead}[1]{%
\chapterheadstartvskip
\begin{mdframed}[style=chapter]
\setlength{\parindent}{\z@}\setlength{\parfillskip}{\fill}%
\normalfont\sectfont\nobreak\size@chapter{}%
\if@chapterprefix
\let\@tempa\raggedsection
\else
\let\@tempa\@hangfrom
\fi
\@tempa{\ifnum \c@secnumdepth >\m@ne%
\if@chapterprefix
\expandafter\size@chapterprefix
\else
\expandafter\size@chapter
\fi
{\chapterformat}%
\if@chapterprefix
\size@chapterprefix{}\endgraf\nobreak\vskip.5\baselineskip
\fi
\fi
}%
{\raggedsection \interlinepenalty \@M \size@chapter{#1}\par}%
\end{mdframed}
\nobreak\chapterheadendvskip
}
\renewcommand*{\@@makeschapterhead}[1]{%
\chapterheadstartvskip%
\begin{mdframed}[style=chapter]
{\normalfont\sectfont\nobreak\size@chapter{}%
\setlength{\parindent}{\z@}\setlength{\parfillskip}{\fill}%
\raggedsection \interlinepenalty \@M \size@chapter{#1}\par}%
\end{mdframed}%
\nobreak\chapterheadendvskip%
}
\makeatother
\begin{document}
% TOC
\tableofcontents
\pagebreak
\chapter{Introduction}
\lipsum[1]
\chapter{Main Part}
\lipsum[2]
\chapter{Conclusion Conclusion Conclusion Conclusion Conclusion Conclusion Conclusion Conclusion Conclusion }
\lipsum[3]
\end{document}