I am writing a complex diagram using TikZ in which the colors used for certain nodes depend on the value of the input variable. I cannot use the color itself as an input variable as certain things other than a color also change.
I have not written this yet, so cannot provide a MWE, but the idea is:
- Check the value of an input parameter (say #1) using \ifthenelse.
- Assign some colors to a set of variable, say boxcolor=red!90!black,flatcolor=blue!30!green, juxtaposecolor=yellow if #1 takes one value, another set of the above colors if #1 takes another value.
- Draw the diagram, using boxcolor, flatcolor, juxtaposecolor, etc. directly, and colors calculated based on them (boxcolor!40!flatcolor).
How do I do this inside a newcommand? Can color variables be first set in some way, and then used in some common code block that follows?