I am trying to define a block with customizable colors. I want to put this in a file of common definitions (say common_defs.tex) and include it in each presentation and set its title and text background and foreground colors based on the theme of that presentation. Using the suggestion here I define the following in the common_defs.tex file
\newenvironment{varblock}[3]{%
\setbeamercolor{block title}{#2}
\setbeamercolor{block body}{#3}
\begin{block}{#1}}{\end{block}}
Now in the main beamer presentation I have the following:
\documentclass{beamer}
\setbeamercolor{varblock text}{bg=red!20, fg=black}
\setbeamercolor{varblock title}{bg=red, fg=white}
\begin{document}
\begin{frame}
\frametitle{Test}
\begin{varblock}{Block Title}
Some block text
\end{varblock}
\end{frame}
\end{document}
This, understandably gives an error since it expects three arguments to \begin{varblock}. How can I change the definition to make this work?