# Filling polygons with color

Is there any good tutorial/approach in LaTeX for drawing polygons filled with color?

EDIT: I would like to use pdfLaTeX interpreter

-

Sure, you can use TikZ for instance. There is a node shape regular polygon, it can be used like this:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}
\foreach \a in {3,...,8}{
\node[regular polygon, regular polygon sides=\a, minimum size=2cm, anchor=south, fill=blue!40] at (\a*4,0) {};
}
\end{tikzpicture}
\end{document}


With the following result:

Note that you can determine the color by changing fill=blue!40 to any color definition you like. If you want to add a border to the polygon, you can use the draw option on the node. You can change the color of that by using draw=color. You don't need to use a node, you can of course contruct a regular polygon path, but a node is the easiest way to directly get a regular polygon.

-
Sorry I didn't mention - I would like to use pdfLaTeX interpreter. Now I see ! LaTeX Error: File standalone.cls' not found. for you example. – Michael Z Jan 30 '12 at 14:38
I have found solution by myself. I use \documentclass{article} instead of \documentclass{standalone} and it works! – Michael Z Jan 30 '12 at 14:42
That just means you don't have the standalone class. You can just as easily use article as the documentclass. I just used standalone in order to get a nice pdf` to upload as an example. – Roelof Spijker Jan 30 '12 at 14:43