[Tex/LaTex] How to change \headsepline color in KOMA-Scriptclasses

colorheader-footerkoma-script

At the moment I am working on a rather big project in which I typeset a lecture note for a professor of mine. I want to use the headsepline the KOMA Script Class offers, but I want it to have the same color as the headlinecolor I defined by adding

\renewcommand{\headfont}{\color{schrift}\normalfont\slshape} 

Is there a solution for this with KOMA Script means or do I have to define it myself (in a way I don't know as I don't really know how to do such things at all)?

Example:

\documentclass[oneside, twocolumn=false, 12pt, headsepline=true]{scrbook}
\usepackage[ngerman]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{delarray, graphicx, url, fancybox, calc, cancel, caption, mathtools, amsmath, amssymb, wrapfig, subcaption, floatrow, amsthm, lipsum}
\usepackage[usenames,dvipsnames]{color}
\usepackage[margin={0.08\paperwidth,0.10\paperheight}, heightrounded]{geometry}

\usepackage[onlytext]{MinionPro}

\parindent 0pt
\parskip 6pt

\usepackage[pdftex, colorlinks=true,pdfstartview=FitB,bookmarks=false, urlcolor=schrift, linkcolor=schrift]{hyperref}
\hypersetup{
  colorlinks,
  linkcolor=schrift,
  linktoc=all
}

\makeatletter
\renewcommand{\l@section}{\@dottedtocline{1}{1.5em}{2.6em}}
\renewcommand{\l@subsection}{\@dottedtocline{2}{4.0em}{3.6em}}
\renewcommand{\l@subsubsection}{\@dottedtocline{3}{7.4em}{4.5em}}
\makeatother

\fboxrule0pt

\definecolor{rahmen}{RGB}{0,73,114}
\definecolor{grund}{RGB}{238,241,251}          
\definecolor{schrift}{RGB}{0,73,114}

\captionsetup{format=plain, labelfont={color=rahmen,bf}}

%\usepackage[nomath]{kpfonts}

\SetSymbolFont{letters}{normal}{OML}{cmbr}{m}{it}
\SetSymbolFont{operators}{normal}{OT1}{cmbr}{m}{n}
\SetSymbolFont{symbols}{normal}{OMS}{cmbr}{m}{n}

\DeclareMathAlphabet{\mathbf} {OT1}{cmbr}{bx}{n}

\setkomafont{disposition}{\color{schrift}\bfseries}

\renewcommand{\headfont}{\color{schrift}\normalfont\slshape}

\renewcommand{\labelitemi}{-}
\renewcommand{\labelitemii}{$\cdot$}
\renewcommand{\labelitemiii}{$\circ$}
\renewcommand{\labelitemiv}{$\bullet$}

\captionsetup{format=plain, labelfont={color=schrift,bf}}

\allowdisplaybreaks

\newcommand{\defeq}{\vcentcolon=}
\newcommand{\eqdef}{=\vcentcolon}

\hfuzz 100pt
\hbadness 10000

\renewcommand{\chapterheadstartvskip}{\vspace *{-\baselineskip }}

\begin{document}

\chapter{This is just some test chapter}

\lipsum[1]
\lipsum[2]
\lipsum[3]
\lipsum[4]
\lipsum[5]
\lipsum[6]

\lipsum[7]

\end{document}

My problem is this output which I want to be in matching color

Headlinesep by KOMA

The option [headlinesep] added to the KOMA Script class I am using adds a horizontal bar between header and the body of the page.

There has been help in the comments I should just use the \scrlayer-scrpage Style, as it offered all the functions I have been looking for. But it appeared, that there more errors to cope with – I'll post my test document code here. Everything that is important allready is in the code

\documentclass[twoside=false, twocolumn=false, 12pt, ngerman, headsepline=true]{scrbook}
\usepackage[ngerman]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{delarray, graphicx, url, fancybox, calc, cancel, caption, amssymb, amsmath, mathtools, wrapfig, floatrow, amsthm, scrlayer-scrpage, lipsum}
\usepackage[usenames,dvipsnames]{color}

\usepackage[margin={0.08\paperwidth,0.10\paperheight}, heightrounded]{geometry}
\renewcommand{\chapterheadstartvskip}{\vspace *{-\baselineskip }}

\usepackage[frenchmath]{MinionPro}

\parindent 0pt
\parskip 6pt
%\baselinestretch

%\usepackage[nomath]{kpfonts}
%\SetSymbolFont{letters}{normal}{OML}{cmbr}{m}{it}
%\SetSymbolFont{operators}{normal}{OT1}{cmbr}{m}{n}
%\SetSymbolFont{symbols}{normal}{OMS}{cmbr}{m}{n}
%\DeclareMathAlphabet{\mathbf} {OT1}{cmbr}{bx}{n}

\setkomafont{disposition}{\color{schrift}\bfseries}
\setheadsepline{1pt}[\color{schrift}]
\renewcommand{\headfont}{\color{schrift}\normalfont\slshape}

\renewcommand{\labelitemi}{-}
\renewcommand{\labelitemii}{$\cdot$}
\renewcommand{\labelitemiii}{$\circ$}
\renewcommand{\labelitemiv}{$\bullet$}

\fboxrule0pt

\definecolor{rahmen}{RGB}{0,73,114}
\definecolor{grund}{RGB}{238,241,251}          
\definecolor{schrift}{RGB}{0,73,114}

\usepackage[pdftex, colorlinks=true,pdfstartview=FitB,bookmarks=false, urlcolor=schrift, linkcolor=schrift]{hyperref}

\captionsetup{format=plain, labelfont={color=rahmen,bf}}

\newcommand{\defeq}{\vcentcolon=}
\newcommand{\eqdef}{=\vcentcolon}

\hfuzz 40pt
\hbadness 10000

\renewcommand{\thefigure}{\arabic{chapter}.\arabic{section}.\arabic{subsection}}

\addto\captionsngerman{
\renewcommand{\figurename}{Aufgabe}}

\parskip 6pt
\parindent 0pt

\makeatletter
\let\stdl@section\l@section
\renewcommand*{\l@section}[2]{%
  \stdl@section{\textcolor{black}{#1}}{\textcolor{black}{#2}}}
\let\stdl@subsection\l@subsection
\renewcommand*{\l@subsection}[2]{%
  \stdl@subsection{\textcolor{schrift}{#1}}{\textcolor{black}{#2}}}
\makeatother

\deftripstyle{versionheading}[][1pt]%
{22.08.2014}{\headmark}{}%
{}{\pagemark}{}

\allowdisplaybreaks

\begin{document}

\chapter{This is just some testing chapter}

\lipsum[1]
\lipsum[2]
\lipsum[3]
\lipsum[4]
\lipsum[5]
\lipsum[6]
\lipsum[7]

\paragraph{Error Prompt 1}

\begin{verbatim}
    Package scrlayer-scrpage Warning: Command \deftripstyle is deprecate.
(scrlayer-scrpage) You should replace it by \deftriplepagestyle,
(scrlayer-scrpage) e.g., on input line 64.
\end{verbatim}

But when I do as the error prompt is telling me, it says the command was undefined.

\end{document}

It now prints the headsepline in the color I desired but the defined pagestyle doesn't work which is why I cant adjust the thickness of the headsepline even though it is shown exactly like this in the KOMA Manual.. Please help me, I have no clue whats going on there! I hope anyone here knows how to deal with the errors because I am completely lost.

The Code produces this:

output of examplecode 2

Best Answer

I took the liberty to write up an answer, making your very large example into a minimal one. As @cgnieder stated in the comments, package scrlayer-scrpage defines an interface for defining page headers and footer; mostly compatible with scrpage2. Mostly, what does that mean? You received a warning, telling you that the command deftripstyle is deprecated. True, it is. But it gives you an alternative, and looking into the KOMA-documentation reveals: You can just change the command name. But using this is not recommended any more and is just there for compatibility reasons.

Is there any reason for making the document look like the standard W0rd stuff? You should also consider using the class scrreprt. @cgnieder made you aware of some other oddities in the comments.

Be careful, you are loading packages twice.

\documentclass{scrreprt}
\usepackage{blindtext}
\usepackage{xcolor}
\usepackage[headsepline,automark]{scrlayer-scrpage}
\addtokomafont{headsepline}{\color{blue}}
\KOMAoptions{headsepline=10pt:\textwidth}
\renewcommand{\headfont}{\color{blue}\normalfont\slshape}
\newcommand{\versiondate}{\today}
\deftriplepagestyle{draftpages}[5pt]
{\versiondate}{\headmark}{}
{Draft}{\pagemark}{}
\begin{document}
\blinddocument
\clearpage
\pagestyle{draftpages}
\blinddocument
\end{document}