-1

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

enter image description here

user3713179
  • 635
  • 2
  • 11

2 Answers2

2

Section 69 Shading Library

enter image description here

\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}

enter image description here


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}

enter image description here

antshar
  • 4,238
  • 9
  • 30
  • Thanks! Can you link the tikz manual? The one I found stops at section 61: https://www.bu.edu/math/files/2013/08/tikzpgfmanual.pdf – user3713179 Jun 30 '22 at 09:09
  • 2
    Here is the official constant link to the manual that updates automatically: https://pgf-tikz.github.io – antshar Jun 30 '22 at 09:18
1
\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}

Ring with cyan color gradient