In my illustration I use simplified sketches of stopwatches (timers), which appear in three different "modes": (1) start of interval (coloured green), (2) time in progress (yellow), and time is expired (red).

For each of these cases, I determined separate styles which differ from each other only in two lines, see MWE:
\documentclass[12pt,tikz,border=3mm]{standalone}
\usetikzlibrary{chains,shapes}
\begin{document}
\begin{tikzpicture}
\tikzset{
node distance = 5mm,
start chain = going right,
boxG/.style 2 args = {name=n#1,
shape=rectangle, draw=#2, thick, inner sep=0mm, on chain,
node contents={\tikz{
\draw[radius=3.5mm,fill=#2!30] (0,0) circle;
\fill[radius=3.4mm,white] (0,0) -- + (90:3.4mm) arc[start angle=90,end angle=135] -- cycle;
\foreach \i in {0,30,...,330} \draw (0,0) ++ (\i:2.5mm) -- (\i:3mm);
\draw ( 0mm,-1mm) -- ++ (0mm,4.0mm);
\draw[orange,ultra thick] (+1mm,-1mm) -- ++ (135:4.5mm);
\draw[thick,->] ( 0mm,-1mm) -- ++ ( 90:4.0mm);
}}
},
boxY/.style 2 args = {name=n#1,
shape=rectangle, draw=#2, thick, inner sep=0mm, on chain,
node contents={\tikz{
\draw[radius=3.5mm,fill=#2!30] (0,0) circle;
\fill[radius=3.4mm,white] (0,0) -- + (90:3.4mm) arc[start angle=90,end angle=135] -- cycle;
\foreach \i in {0,30,...,330} \draw (0,0) ++ (\i:2.5mm) -- (\i:3mm);
\draw ( 0mm,-1mm) -- ++ (0mm,4.0mm);
\draw[orange,ultra thick] (+1mm,-1mm) -- ++ (135:4.5mm);
\draw[thick,->] (+1mm,+1mm) -- ++ (225:4.0mm);
}}
},
boxR/.style 2 args = {name=n#1,
shape=circle, draw=#2, thick, inner sep=0mm, on chain,
node contents={\tikz{
\draw[radius=3.5mm,fill=#2!30] (0,0) circle;
\fill[radius=3.4mm,white] (0,0) -- + (90:3.4mm) arc[start angle=90,end angle=135] -- cycle;
\foreach \i in {0,30,...,330} \draw (0,0) ++ (\i:2.5mm) -- (\i:3mm);
\draw ( 0mm,-1mm) -- ++ (0mm,4.0mm);
\draw[yellow,ultra thick] (+1mm,-1mm) -- ++ (135:4.5mm);
\draw[thick,->] (+1mm,-1mm) -- ++ (135:4.0mm);
}}
},
}
\node[boxG={1}{green}];
\node[boxY={2}{yellow}];
\node[boxR={3}{red}];
\end{tikzpicture}
\end{document}
I was wondering whether it is possible to determine just one style, where the last two lines are selected regarding the used color, something like this:
timer/.style 2 args = {name=n#1,
shape=circle, draw=#2, thick, inner sep=0mm, on chain,
node contents={\tikz{
\draw[radius=3.5mm,fill=#2!30] (0,0) circle;
\fill[radius=3.4mm,white] (0,0) -- + (90:3.4mm) arc[start angle=90,end angle=135] -- cycle;
\foreach \i in {0,30,...,330} \draw (0,0) ++ (\i:2.5mm) -- (\i:3mm);
\draw ( 0mm,-1mm) -- ++ (0mm,4.0mm);
%%%% pseudocode for conditional selecting of appropriate last two lines
if #2 = green
\draw[orange,ultra thick] (+1mm,-1mm) -- ++ (135:4.5mm);
\draw[thick,->] ( 0mm,-1mm) -- ++ ( 90:4.0mm);
else if #2 = yellow
\draw[orange,ultra thick] (+1mm,-1mm) -- ++ (135:4.5mm);
\draw[thick,->] (+1mm,+1mm) -- ++ (225:4.0mm);
else if #2 = red
\draw[yellow,ultra thick] (+1mm,-1mm) -- ++ (135:4.5mm);
\draw[thick,->] (+1mm,-1mm) -- ++ (135:4.0mm);
fi fi fi
%%%%
}}}
Additional question: in the third timer, why isn't the distance between the inner picture and outer node equal to zero as it is in the first two (finally I would like to have a circle for outer node)?




inner sep=-1mminboxRsolves last question. – Ignasi Jun 04 '14 at 08:10\@namedef{clock-green}{LAST TWO LINES}etc for each color (once, in the preamble) and then in the node contents do\@nameuse{clock-#2}– Bordaigorl Jun 04 '14 at 08:10picaction. – Bordaigorl Jun 04 '14 at 08:15