[Tex/LaTex] How to specify transparent colors

colortransparency

What options are there to specify transparent colors, say the background in the example below? I thought xcolor would be able to do this but I can not find any reference to "alpha" or "transparency" in the manual.

\documentclass{article}
\usepackage{listings,xcolor}

\lstset{frame=shadowbox, backgroundcolor=\color{green}}

\title{Transparency test}

\begin{document}
\maketitle
\begin{lstlisting}
Hello, world.
\end{lstlisting}
\end{document}

Is it possible to do it with XeLaTeX or LuaLaTeX?

Best Answer

I think you might be looking for transparent.

\documentclass{article}
\usepackage{color}
\usepackage{transparent}
\begin{document}
  \colorbox{red}{%
    Black text in a red box %
    \transparent{1.0}%
    \colorbox{blue}{%
      and now a blue box is added%
    }
  }

  \colorbox{red}{%
    Black text in a red box %
    \transparent{0.5}%
    \colorbox{blue}{%
      and now a transparent blue box is added%
    }
  }
\end{document}

enter image description here