I want to fill a node with a specific color, but not with the usual [fill=blue]
way. The reason is, that I am creating many many nodes and I want to fill some random nodes with a different color from the others, so the coloring can not be embedded in the creation process. Any ideas?
\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{calc,trees,positioning,arrows,chains,shapes.geometric,%
decorations.pathreplacing,decorations.pathmorphing,shapes,%
matrix,shapes.symbols}
\begin{document}
\begin{tikzpicture}[darkstyle/.style={circle,draw,fill=gray!20,minimum size=20}]
\foreach \x in {0,...,2}
\foreach \y in {0,...,2}
{\pgfmathtruncatemacro{\label}{\x - 5 * \y +21}
\node [darkstyle] (\x\y) at (1.5*\x,1.5*\y) {};}
\foreach \x in {0,...,2}
\foreach \y [count=\yi] in {0,...,1}
\draw (\x\y)--(\x\yi) ;
\draw [decorate,decoration={brace,amplitude=7pt,raise=2pt,aspect=0.5}] (20.south) -- (00.south);
\foreach \x in {0,...,2}
\foreach \y in {0,...,3}
{\pgfmathtruncatemacro{\label}{\x - 5 * \y +21}
\node [darkstyle] (\x\y) at (10+1.5*\x,1.5*\y) {};}
\foreach \x in {0,...,2}
\foreach \y [count=\yi] in {0,...,2}
\draw (\x\y)--(\x\yi) ;
\draw [decorate,decoration={brace,amplitude=7pt,raise=2pt,aspect=0.5}] (20.south) -- (00.south);
\foreach \x in {0,...,5}
\foreach \y in {0,...,4}
{\pgfmathtruncatemacro{\label}{\x - 5 * \y +21}
\node [darkstyle] (\x\y) at (3+1.5*\x,-10+1.5*\y) {};}
\foreach \x in {0,...,5}
\foreach \y [count=\yi] in {0,...,3}
\draw (\x\y)--(\x\yi) ;
\end{tikzpicture}
\end{document}
Lets say we want to fill with blue color the top leftmost node and the bottom rightmost node.
Best Answer