[Tex/LaTex] Transparent background for mdframed environment

backgroundsmdframedtransparency

Is it possible to specify a transparent background colour for the mdframed environment, so that anything which might be underneath will be visible?

Best Answer

You must set the opacity to the whole environment.

\documentclass{article}
\usepackage{tikz}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{lipsum}
\usepackage{background}
\SetBgContents{top secret}
\SetBgColor{red}
%  \tikzset{mdfbackground/.style={fill=red,opacity=0.1,draw=green}}%
\newmdenv[tikzsetting={draw=blue,fill=red,},settings={\tikzset{every picture/.style={opacity=0.6}}}]{myenvironment}
\begin{document}
\BgThispage

\begin{tikzpicture}
\draw[blue,fill] (0,0) rectangle (8,4);
\node[text width=8cm] {\lipsum[1]};
\end{tikzpicture}

\begin{myenvironment}
\lipsum[1]
\end{myenvironment}
\end{document}