I have a defined command as shown in the MWE as follows:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\newcommand\shapes[3]
{\begin{tikzpicture}
\draw[fill=#1] (0,0) rectangle (1,1);
\draw[fill=#2] (0,2.5) circle (0.5);
\draw[fill=#3] (3,2) ellipse (1 and 0.75);
\end{tikzpicture}}
\begin{document}
\shapes{yellow}{green!50}{red!50}
\end{document}
Sometimes I don't want to color a particular shape in, which is when I set the fill color to none
, like so: \shapes{yellow}{none}{none}
.
However, when I do this, I don't want the border to remain (in other words, I want the shape to disappear completely if I specify the color as none
– I don't want the border to remain.
Is there a good way to way to automatically make the border color none (or perhaps make the \draw
command a \fill
command, if the fill color is none (which would get rid of the border)?
\newcommand\shapes[3] {\begin{tikzpicture} \fill[fill=#1] (0,0) rectangle (1,1); \fill[fill=#2] (0,2.5) circle (0.5); \fill[fill=#3] (3,2) ellipse (1 and 0.75); \end{tikzpicture}}
doesn't gives what you like to have?ifthen
conditionals (which I guess is the best way to do it, it seems)