Is there a simple way to create a transparent node with opaque text? Preferably without having to use a postaction or redraw the node.
In the example below I'd like to achieve the effect of the first three nodes, without redrawing the second node to create the opaque text:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
% desired effect:
\node [fill=red,circle,minimum size=6mm,inner sep=0mm] {};
\node [right,fill=green,opacity=.2] {Node};
\node [right] {Node};
% undesired effect:
\node at(2,0) [fill=red,circle,minimum size=6mm,inner sep=0mm] {};
\node at(2,0) [right,fill=green,opacity=.2] {Node};
\end{tikzpicture}
\end{document}
Best Answer
After setting the
opacity
, you have to reset thetext opacity=1
to get opaque text. Theopacity
key is a shorthand for setting thedraw opacity
and thefill opacity
at the same time, and thefill opacity
in turn automatically applies to thetext opacity
.