# Opacity with a pgf-umlcd diagram

Can anyone help me get an opacity scope to work correctly with pgf-umlcd inheritance relation?

\documentclass{minimal}
\usepackage{pgf-umlcd}

\begin{document}

\begin{tikzpicture}
\begin{scope}[opacity=0.3]
\begin{class}{Foo}{0, 2cm}
\end{class}
\begin{class}{Bar}{0, 0cm}
\inherit{Foo}
\end{class}
\end{scope}
\end{tikzpicture}

\end{document}


Notice the inheritance relation doesn't get the reduced opacity.

• I don't quite understand your use of transparency group here. Isn't just opacity what you need? \documentclass{minimal} \usepackage{pgf-umlcd} \begin{document} \begin{tikzpicture} \begin{scope}[opacity=0.5] \begin{class}{Foo}{0, 2cm} \end{class} \begin{class}{Bar}{0, 0cm} \inherit{Foo} \end{class} \end{scope} \end{tikzpicture} \end{document} – Gonzalo Medina Sep 12 '15 at 21:38
• Indeed. Edited question and made the resulting image more clear. – William Sep 12 '15 at 21:59

It's not entirely clear to me why this happens, but there are a couple of workarounds. One is to append the opacity setting to the umlcd style inherit line style in addition, another is to use every path/.append style={opacity=0.3}.

\documentclass{article}
\usepackage{pgf-umlcd}

\begin{document}

\begin{tikzpicture}
\begin{scope}[
%opacity=0.3,umlcd style inherit line/.append style={opacity=0.3},
every path/.append style={opacity=0.3}
]
\begin{class}{Foo}{0, 2cm}
\end{class}
\begin{class}{Bar}{0, 0cm}
\inherit{Foo}
\end{class}
\end{scope}
\end{tikzpicture}
\end{document}