Where I can find the section about color gradient in the tikz documentation? Specifically, I would like to make the gradient you see in the outermost ring of this image. Forget the rest, I can easily do it later, for the moment I am only interested in the gradient of the outermost ring
2 Answers
Section 69 Shading Library
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shadings}
\begin{document}
\begin{tikzpicture}
\draw[cyan, top color=cyan,bottom color=cyan,middle color=white] (0,0) circle[radius=50pt];
\draw[fill=gray] (0,0) circle[radius=30pt];
\end{tikzpicture}
\end{document}
For more advanced gradient look at Section 114.2 Declaring Shadings
Using \pgfdeclareverticalshading
in this case, you can specify any amount of colors and the placement, with etc.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shadings}
\begin{document}
\pgfdeclareverticalshading{mygradient}{2cm}{color(0cm)=(blue!50!cyan); color(1.5cm)=(white); color(2.5cm)=(white); color(4cm)=(blue!50!cyan)}
\begin{tikzpicture}
\draw[cyan, shading=mygradient] (0,0) circle[radius=50pt];
\draw[fill=gray] (0,0) circle[radius=30pt];
\end{tikzpicture}
\end{document}
-
Thanks! Can you link the tikz manual? The one I found stops at section 61: bu.edu/math/files/2013/08/tikzpgfmanual.pdf Jun 30, 2022 at 9:09
-
2Here is the official constant link to the manual that updates automatically: pgf-tikz.github.io– antsharJun 30, 2022 at 9:18
\documentclass[tikz, border=1cm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw[top color=cyan!60!white, bottom color=cyan!60!white, middle color=white] (0,0) circle[radius=4cm];
\filldraw[fill=gray, ultra thick] (0,0) circle[radius=3cm];
\end{tikzpicture}
\end{document}