%! Author = soeichho
%! Date = 20.11.2020

% Text style
%\setmainfont{\mainFont}
\setstretch{\lineStretchValue}          % Space between lines
\tolerance=1000
\emergencystretch=1em

% Chapter format
\renewcommand*{\chapterformat}{
    \thechapter \hspace{10pt} \textcolor{accent-color}{|} \hspace{10pt}
}
\renewcommand*{\chapterheadstartvskip}{\vspace*{0pt}}


% Header / Footer
\clearpairofpagestyles
\KOMAoptions {
    headsepline = true,
    footsepline = true,
    plainfootsepline = true
}
\automark[chapter]{chapter}

\ihead{\headmark}
\ifoot{\author~~|~~\kurs~~|~~\date}
\ofoot{\thepage}

\renewcommand*{\headfont}{\normalfont} % Keine kursive Schrift
\renewcommand*{\footfont}{\normalfont}

\newpairofpagestyles{chapterpage}{
    \KOMAoptions {
        headsepline = false,
        footsepline = true,
        plainfootsepline = true
    }
    \ihead{}
    \ifoot{\author~~|~~\kurs~~|~~\date}
    \ofoot{\thepage}
}

\renewcommand*{\chapterpagestyle}{chapterpage}


% Listings style
\lstset{
    basicstyle=\ttfamily\small,
    frame=top,
    frame=bottom,
    breaklines=true,
    tabsize=2,
    upquote = true,
    numbers=left,
    stepnumber=1,
    numbersep=5pt,
    commentstyle=\color{teal},
    stringstyle=\color{magenta},
    keywordstyle=\color{orange}
}

\lstdefinelanguage{JSON}{
    string=[s]{"}{"},
    comment=[l]{:\ "},
    morecomment=[l]{:"},
}

\lstdefinelanguage{JavaScript}{
    keywords={const, let, typeof, instanceof, new, true, false, catch, function, return, null, undefined, catch, switch, var, if, in, while, for, do, else, case, default, break},
    ndkeywords={class, export, throw, import, this},
    sensitive=false,
    comment=[l]{//},
    morecomment=[s]{/*}{*/},
    morestring=[b]',
    morestring=[b]`,
    morestring=[b]"
}

% Float listings
\newfloat{lstfloat}{htbp}{lop}
\floatname{lstfloat}{Listing}
\def\lstfloatautorefname{Listing} % needed for hyperref/auroref