[Tex/LaTex] Why ‘ every label/.style={draw}’ also `fill`s

tikz-pgf

Please look at next code and its result:

\documentclass[tikz,border=2mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}

\begin{tikzpicture}[every node/.style={draw=red,fill=green},]
\node[label=above:a] (A) {AAA};

\node[label={[draw]above:b}, right=of A] (B) {BBB};

\begin{scope}[every label/.style={draw}]
    \node[label=above:c, right=of B] (C) {CCC};
\end{scope}
\end{tikzpicture}
\end{document}

enter image description here

I understand that labels are nodes which are created after its main node. (Look at Every non-label node in TikZ), so I understand that options draw or fill inherit main node colors as is shown in middle node. But I don't understand why every label/.style={draw} also fills the label, as is shown in right most node above. Could you explain it?

Best Answer

This happens because by default, every label is defined as draw=none,fill=none. By setting every label/.style=draw, you're overwriting these options, and the fill=green from the every node style is used. To get the expected behaviour, use every label/.append style=draw.