# TikZ colour and shading examples

> Colour and shading in TikZ with code: a colour wheel, a colour triangle, ball shading, a shaded spiral, a slanted cube and op-art circles drawn with \foreach.

URL: https://www.labcanvas.com/tikz/examples/colour-and-shading

Six figures from the code of Stefan Kottwitz’s *LaTeX Graphics with TikZ*: a colour wheel, a colour triangle, ball shading, a shaded spiral of segments, a slanted cube and op-art circles. The colour wheel and the colour triangle use shadings from the `shadings` library, the ball is filled with `ball color`, the spiral mixes its colour with xcolor expressions such as `black!60!blue!\c!white` inside a `\foreach` loop, and the op-art circles are a single `\foreach` with the even–odd fill rule.

## Colour & shading

- **Colour wheel** (Colour & shading): MIT licence, © Packt (code from LaTeX Graphics with TikZ by Stefan Kottwitz). Source: https://github.com/PacktPublishing/LaTeX-graphics-with-TikZ/blob/82e099639f46ee92bc622a01c739e7f7a3e87f4b/07-filling-clipping-shading/27-color-wheel.tex. Code: https://www.labcanvas.com/tikz-library/code/colour-wheel.tex
- **Colour triangle** (Colour & shading): MIT licence, © Packt (code from LaTeX Graphics with TikZ by Stefan Kottwitz). Source: https://github.com/PacktPublishing/LaTeX-graphics-with-TikZ/blob/82e099639f46ee92bc622a01c739e7f7a3e87f4b/07-filling-clipping-shading/29-color-triangle.tex. Code: https://www.labcanvas.com/tikz-library/code/colour-triangle.tex
- **Ball shading** (Colour & shading): MIT licence, © Packt (code from LaTeX Graphics with TikZ by Stefan Kottwitz). Source: https://github.com/PacktPublishing/LaTeX-graphics-with-TikZ/blob/82e099639f46ee92bc622a01c739e7f7a3e87f4b/07-filling-clipping-shading/25-ball-shading.tex. Code: https://www.labcanvas.com/tikz-library/code/ball-shading.tex
- **Shaded spiral of segments** (Colour & shading): MIT licence, © Packt (code from LaTeX Graphics with TikZ by Stefan Kottwitz). Source: https://github.com/PacktPublishing/LaTeX-graphics-with-TikZ/blob/82e099639f46ee92bc622a01c739e7f7a3e87f4b/10-calculating-transforming/10-colored-segments-spiral.tex. Code: https://www.labcanvas.com/tikz-library/code/shaded-spiral-of-segments.tex
- **Slanted cube** (Colour & shading): MIT licence, © Packt (code from LaTeX Graphics with TikZ by Stefan Kottwitz). Source: https://github.com/PacktPublishing/LaTeX-graphics-with-TikZ/blob/82e099639f46ee92bc622a01c739e7f7a3e87f4b/11-transforming-coordinates/08-slanted-cube.tex. Code: https://www.labcanvas.com/tikz-library/code/slanted-cube.tex
- **Op-art circles (foreach)** (Colour & shading): MIT licence, © Packt (code from LaTeX Graphics with TikZ by Stefan Kottwitz). Source: https://github.com/PacktPublishing/LaTeX-graphics-with-TikZ/blob/82e099639f46ee92bc622a01c739e7f7a3e87f4b/10-calculating-transforming/03-filled-circles-loop.tex. Code: https://www.labcanvas.com/tikz-library/code/op-art-circles-foreach.tex

## Using these figures

Every figure keeps its own licence: MIT or CC0 1.0, both of which allow use, change and sharing, commercial use included. The MIT licence asks that its copyright and permission notice go with copies of the code, so each figure’s code starts with its source, author and licence; keep those lines when you reuse it. The full licence texts are on the [sources and licences page](https://www.labcanvas.com/tikz-library/credits.html).

“Open in the TikZ editor” loads the figure’s complete document into the free TikZ editor, where it is typeset with TeX Live 2026 and you can change it and download a PNG. To compile it on your own computer, save the code as a.tex file and run pdfLaTeX (or the engine the tile names) on it; LabCanvas changed the files only where needed to make each one compile on its own, as its first lines say.

Licence texts: https://www.labcanvas.com/tikz-library/credits.html
