How do I reference a template colour in beamer?

Say I want to draw a beamercolorbox and have it be coloured with the colour used for block body alerted.bg. How can I do this? I read this question, but it turned out to be unhelpful. I need to somehow reference the colour by name. So I'd like something like this

\begin{beamercolorbox}[center,wd=\paperwidth]{block body.fg}
<content>
\end{beamercolorbox}


But that does not work. Judging from fruitless googling there seems to be no easy way to directly use the template-defined colour to stay consistent, is there?

• Please make your code compilable with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. – user36296 Dec 5 '15 at 14:40

It sounds like you want to invert a colour?

\documentclass{beamer}

\begin{document}

\begin{frame}

blub
\end{beamercolorbox}

blub
\end{beamercolorbox}

\end{frame}

\end{document}

• No, I do not. The question is merely how to reference template-defined colours by name for use in arbitrary places. But \begin{beamercolorbox}[center,wd=\paperwidth]{block body alerted}... does what I want, somehow I did not realise this actually works. – oarfish Dec 6 '15 at 6:25

I didn't realise you can just call them by their names, i.e.

\begin{beamercolorbox}[center,wd=\paperwidth]{block body}
<content>
\end{beamercolorbox}


but apparently, you cannot reference background or foreground colours like this.

• You can reference background and foreground colours like this, just beamercolorbox expects a full beamer colour as argument, consisting of a foreground and a background colour. – user36296 Dec 8 '15 at 10:16