# Color gradient in tikzpicture from top to bottom corner

Is there the possiblity to make a color gradient in the rectangular box in the following example from the bottom left to the top right corner (both in linear or radial shape)?

\documentclass{article}
\usepackage{tikz}

\usepackage{xcolor}

\definecolor{left} {HTML}{001528}

\begin{document}

\begin{tikzpicture}[remember picture,overlay]
\node [rectangle, left color=left, right color=left!30!white, anchor=north, minimum width=\paperwidth, minimum height=5.5cm] (box) at (current page.north){};
\end{tikzpicture}

\end{document}


• I understand the question for linear, I think, but I have no idea what you are looking for in the radial case. How would that look different from just a bog-standard radial shading? Also, please make your code compilable. As it stands, I am certain that it will not do so! – cfr Dec 7 '14 at 22:21
• For the radial case I meant somethin like this: encrypted-tbn3.gstatic.com/… but just with the center of the lightest point in the top right corner – Adrian Pfeifle Dec 7 '14 at 22:23
• fixed my code, now its compilable – Adrian Pfeifle Dec 7 '14 at 22:42

You can use shading = axis and shading angle=135

\documentclass{article}
\usepackage{tikz}

\definecolor{left} {HTML}{001528}

\begin{document}

\begin{tikzpicture}[remember picture,overlay]
\node [shading = axis,rectangle, left color=left, right color=left!30!white,shading angle=135, anchor=north, minimum width=\paperwidth, minimum height=5.5cm] (box) at (current page.north){};
\end{tikzpicture}
\end{document}


I hope this is what you mean:

\documentclass{article}
\usepackage{tikz}

\definecolor{left} {HTML}{001528}

\begin{document}

\begin{tikzpicture}[remember picture,overlay]
\node [rectangle, left color=left, right color=left!30!white, anchor=north, minimum width=\paperwidth, minimum height=5.5cm] (box) at (current page.north){};
% manual 181
\node [rectangle, fill=left!30!white, postaction={path fading=north, fading angle=-45, fill=left}, anchor=north, below=10mm of box, minimum width=\paperwidth, minimum height=5.5cm] (box1) {};
\begin{scope}
\clip (box1.south west) +(0,-10mm) coordinate (c1) rectangle +(\paperwidth,-150mm) coordinate (c2);
\node [inner color=left!30!white, outer color=left, circle through={(c1 |- c2)}] at (c1 -| c2) {};
\end{scope}
\end{tikzpicture}

\end{document}

• I like your 2nd option the most. But there is to the very right side a kind of mistake in the fading. A few pixels from the top to the bottom are not fading. Why is that? – Adrian Pfeifle Dec 8 '14 at 9:00
• @AdrianPfeifle I'm not sure why that happens. I thought it might be an artefact of my PDF viewer since I've seen similar before, when others haven't. Does it reproduce for you? – cfr Dec 8 '14 at 13:38
• yes I get the same result – Adrian Pfeifle Dec 8 '14 at 13:48
• but I'm not sure if the other answer produces the same result as your 2nd option should or if there is a difference? Because there I don't get the mistake on the right side – Adrian Pfeifle Dec 8 '14 at 13:49