I am trying to create a twosided document with KomaScript. I want to add an extra something to every page where a new section begins. I started with creating a new pagestyle according to this post. I tried to modify the example given there. So far, I have done this:
\documentclass[12pt,a4paper,ngerman, twoside]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[ngerman]{babel}
\usepackage[left=3.8cm,right=2.2cm,top=3cm,bottom=3cm]{geometry}
\usepackage{xcolor}
\usepackage[headsepline, automark]{scrlayer-scrpage}
\clearpairofpagestyles
\renewcommand*\pagemark{{\usekomafont{pagenumber}Seite\nobreakspace\thepage}}
\automark[section]{section}
\ihead*{\headmark}
\ohead*{\pagemark}
\chead{}
\cfoot[]{}
\ofoot[]{}
\ifoot[]{}
\newpairofpagestyles{highlights}{
\chead{}
\KOMAoptions{headsepline=false}
\ohead*{\colorbox{blue!15}{%
\makebox[\dimexpr\linewidth-2\fboxsep][l]{\color{white}%
\hfill
\pagemark}
}
}
}
\begin{document}
\section{Section 1}
Some text.
\cleardoublepage
\thispagestyle{highlights}
\section{Section 2}
Some text.
\end{document}
This results in this style of header:
I would like to achieve three things:
Create a custom pagestyle in the given MWE that I can activate on specific pages (where new sections begin) which contains the colorbar (which I specify in the following) and the pagenumber
Create the colorbar with a color gradient behind thpage numberer in the header (it would be nice if the colorbar optionally could also extend out of the header region in the inner or outer direction, depending on taste)
Change the textcolor of the pagemark to be white, so I have white text in front of the colorbar.
To visualize what I am after, I edited the important page of my MWE; this is what I desire to achieve:
I already tried to create a new pagestyle in the following way, which also was suggested in the above link. I don't have enough experience with tikz
though to make it work:
\usepackage{tikz}
\DeclareNewLayer[background,head,
contents={\hspace*{0cm}%
\tikz{
\fill[shade,left color=blue!0,right color=blue!20,right color=blue!70] (0,0)rectangle(20cm ,{1.4cm});
\node[rotate=0,font=\bfseries] at({\textwidth-0.9cm},{0})
{\ppagemark};
}}
]{highlights.bg}
\DeclareNewPageStyleByLayers{highlights}{highlights.bg}
Also, with this approach I don't even know how I would get the page number where I want.
Maybe someone of you has done this before or understands the matter deeply enough to be able to help me out.