How to change fill opacity without affecting the angle label?
Tikz distinguishes between fill opacity
and text opacity
. If not both are set, defining fill opacity
overrides the setting for text opacity
. If you set text opacity=1
you'll get:
Code:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{quotes,angles}
\begin{document}
\begin{tikzpicture}
\draw (0.4,-0.5) -- (0.4,0.8); % a line to show if opacity works
\draw coordinate (a) at (3,-1);
\draw coordinate (b) at (0,0);
\draw coordinate (c) at (1,1);
\draw (a) -- (b) -- (c) pic ["$\alpha$",draw=orange,fill=orange!50,fill opacity=0.5, text opacity=1,angle radius=1cm] {angle=a--b--c};
\end{tikzpicture}
\end{document}
You can add options for the label itself using the syntax
"some text" {<options for the label>}, <other options>
hence pic ["$\alpha$" opacity=1,draw=orange,fill=orange!50,fill opacity=0.5,angle radius=1cm] {angle=a--b--c}
gives you the desired effect. Note no comma after " ... "
. The braces aren't needed in this specific case because there is only one option, opacity
.
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{quotes,angles}
\begin{document}
\begin{tikzpicture}
\draw (0.4,-0.5) -- (0.4,0.8); % a line to show if opacity works
\draw coordinate (a) at (3,-1);
\draw coordinate (b) at (0,0);
\draw coordinate (c) at (1,1);
\draw (a) -- (b) -- (c) pic ["$\alpha$" opacity=1,draw=orange,fill=orange!50,fill opacity=0.5,angle radius=1cm] {angle=a--b--c};
\end{tikzpicture}
\end{document}