[Tex/LaTex] Colore Line in Headline and Footline

header-footer

i would like to add some colored-lines to my documentation and i while searching through the www i found this post here: Colored horizontal line between two text

According to this, i would ask you, how i could add these lines to my headline and footline so it would look like the painted version below…

Image removed after solved…

My layout file looks like this:

    % Seitenränder -----------------------------------------------------------------
\setlength{\topskip}{\ht\strutbox} % behebt Warnung von geometry
\geometry{a4paper,left=20mm,right=20mm,top=25mm,bottom=35mm}

\usepackage[
    automark, % Kapitelangaben in Kopfzeile automatisch erstellen
    headsepline, % Trennlinie unter Kopfzeile
    ilines % Trennlinie linksbündig ausrichten
]{scrpage2}

% Kopf- und Fußzeilen ----------------------------------------------------------
\pagestyle{scrheadings}
\renewcommand{\titlepagestyle}{scrheadings}
\clearscrheadfoot

% Kopfzeile
\renewcommand{\headfont}{\normalfont} % Schriftform der Kopfzeile
\ihead{\large{\textsc{\titel}}\\ \small{\untertitel} \\[2ex] \textit{\headmark}}
\chead{}
\ohead{\includegraphics[scale=0.4]{\logo}}
\setlength{\headheight}{15mm} % Höhe der Kopfzeile
%\setheadwidth[0pt]{textwithmarginpar} % Kopfzeile über den Text hinaus verbreitern (falls Logo den Text überdeckt) 

% Fußzeile
\ifoot{\copyright\ \autor}
\cfoot{}
\ofoot{\pagemark}

\onehalfspacing % Zeilenabstand 1,5 Zeilen
\frenchspacing % erzeugt ein wenig mehr Platz hinter einem Punkt 

% Schusterjungen vermeiden
\clubpenalty = 10000
\widowpenalty = 10000 
\displaywidowpenalty = 10000

% Quellcode-Ausgabe formatieren
\lstset{numbers=left, numberstyle=\tiny, numbersep=5pt, breaklines=true}
\lstset{emph={square}, emphstyle=\color{red}, emph={[2]root,base}, emphstyle={[2]\color{blue}}}

\counterwithout{footnote}{section} % Fußnoten fortlaufend durchnummerieren
\setcounter{tocdepth}{\subsubsectionlevel} % im Inhaltsverzeichnis werden die Kapitel bis zum Level der subsubsection übernommen
\setcounter{secnumdepth}{\subsubsectionlevel} % Kapitel bis zum Level der subsubsection werden nummeriert

% Aufzählungen anpassen
\renewcommand{\labelenumi}{\arabic{enumi}.}
\renewcommand{\labelenumii}{\arabic{enumi}.\arabic{enumii}.}
\renewcommand{\labelenumiii}{\arabic{enumi}.\arabic{enumii}.\arabic{enumiii}}

% Tabellenfärbung:
\definecolor{heading}{rgb}{0.64,0.78,0.86}
\definecolor{odd}{rgb}{0.9,0.9,0.9}
\definecolor{ww-lightblue}{RGB}{73, 111, 185}
\definecolor{ww-darkblue}{RGB}{22, 59, 124}
\definecolor{ww-orange}{RGB}{248, 147, 36}

Best Answer

Here's what you can do.

Load the scrlayer-scrpage package (instead of scrpage2 which is not recommended anymore) and define the thickness of the lines with, for example

\usepackage[automark,headsepline=3pt,footsepline=3pt]{scrlayer-scrpage}

Then add the color to the font used to typeset them, with, for example

\addtokomafont{headsepline}{\color{blue}}
\addtokomafont{footsepline}{\color{orange}}

MWE

\documentclass{scrbook}

\usepackage{lipsum} % only for the example

\usepackage{xcolor}

\usepackage[automark,headsepline=3pt,footsepline=3pt]{scrlayer-scrpage}

\addtokomafont{headsepline}{\color{blue}}
\addtokomafont{footsepline}{\color{orange}}

\pagestyle{scrheadings}

\begin{document}

\chapter{Test}

\lipsum[1-5]

\section{A section}

\lipsum[1-5]

\end{document} 

Output

enter image description here