0

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
1

It sounds like you want to invert a colour?

\documentclass{beamer}

\setbeamercolor{invert block body alerted}{fg=block body alerted.bg, bg=block body alerted.fg}

\begin{document}

    \begin{frame}

\begin{beamercolorbox}[center,wd=\paperwidth]{block body alerted}
    blub
\end{beamercolorbox}

\begin{beamercolorbox}[center,wd=\paperwidth]{invert block body alerted}
    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
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.