I have a "fading line" from white to grey in my header. I wanted to add a page with a different background colour, and therefore fade from this colour instead of white. The problem is that the start of the gradient doesn't match the colour of the page... Any ideas? Complete code below.
\documentclass[11pt, titlepage, openright]{book}
\usepackage[textwidth=13cm, left=2.5cm, bottom=2cm, top=2.5cm, paperwidth=20cm, paperheight=27cm, layoutwidth=19cm, layoutheight=26cm, layouthoffset=0.5cm, layoutvoffset=0.5cm, showcrop, asymmetric]{geometry}
\usepackage{fancyhdr}
\usepackage{tikz}
\usepackage{lipsum}
\definecolor{bgsummary}{cmyk}{0.2,0,0.1,0}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\fancyhead{}
\fancyfoot{}
\definecolor{grey}{rgb}{0.6,0.6,0.6}
\definecolor{darkgrey}{rgb}{0.4,0.4,0.4}
\setlength{\headheight}{24pt}
\fancyhead[RO]{\sffamily\bfseries\textcolor{grey}\leftmark\hspace{0.3cm}\sffamily\textcolor{darkgrey}\thepage}
\fancyhead[LE]{\sffamily\bfseries\textcolor{darkgrey}\thepage\hspace{0.3cm}\sffamily\textcolor{grey}\leftmark}
\renewcommand{\headrulewidth}{0.6pt}
\renewcommand{\footrulewidth}{0pt}
\renewcommand{\headrule}{%
\vskip-\baselineskip\vskip4pt
\ifodd\count0\hfill\begin{tikzpicture}
\shade[left color=white, right color=black, dashed] (0,0) rectangle (4.98,0.01);
\end{tikzpicture}\else\begin{tikzpicture}
\shade[left color=black, right color=white, dashed] (0,0) rectangle (4.98,.01);
\end{tikzpicture}\fi}
\fancypagestyle{summary}{%
\fancyhead[RO]{\sffamily\bfseries\footnotesize\textcolor{grey}\leftmark\hspace{0.3cm}\sffamily\bfseries\normalsize\textcolor{darkgrey}\thepage}
\fancyhead[LE]{\sffamily\bfseries\textcolor{darkgrey}\thepage\hspace{0.3cm}\sffamily\bfseries\footnotesize\textcolor{grey}\leftmark}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\renewcommand{\headrule}{%
\vskip-\baselineskip\vskip4pt
\ifodd\count0\hfill\begin{tikzpicture}
\shade[left color=bgsummary, right color=darkgrey, dashed] (0,0) rectangle (4.98,0.01);
\end{tikzpicture}\else\begin{tikzpicture}
\shade[left color=darkgrey, right color=bgsummary, dashed] (0,0) rectangle (4.98,0.01);
\end{tikzpicture}\fi}
}
\begin{document}
\chapter{Test chapter with a long title}
\lipsum
\newpage
\thispagestyle{summary}
\section{Summary}
\pagecolor{bgsummary}
\end{document}




