this is some kind of a expansion of latex/tikz macro conditional
up to now, I have something like this:
\newif\ifCond
\tikzset{
cond/.is if=Cond,Cond/.default=false,
}
\newcommand{\myTikZdrawing}[1][Cond=false]{
\begin{tikzpicture}[#1]
\draw (0,0) rectangle (1,1);
\ifCond
\draw (0,0) rectangle (0.5,0.5);
\fi
\end{tikzpicture}
}
This works so far for (de)activating that the second rectangle is drawn. But now I'd like to set the background color of the first rectangle when executing this macro (best would be again with tikz keys).
Up to now I tried something like this with an .is choice
key:
\definecolor{color1}{HTML}{cccdf1}
\newif\ifCond
\tikzset{
cond/.is if=Cond,Cond/.default=false,
bgCol/blue/.style={fill=color1},
}
\newcommand{\myTikZdrawing}[1][Cond=false]{
\begin{tikzpicture}[#1]
\draw (0,0) rectangle (1,1);
\ifCond
\draw (0,0) rectangle (0.5,0.5);
\fi
\end{tikzpicture}
}
Now I can pass [bgCol=blue]
to the draw command, but I didn't found a way to set this option from the outside when using this macro later on in the document.
Any suggestions?