GeneralDefining block colors in Beamer (more than once)

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
xbc
Posts: 6
Joined: Mon Apr 30, 2012 12:47 am

Defining block colors in Beamer (more than once)

Post by xbc »

Hello everyone.

My question involves redefining the color scheme of blocks in Beamer, twice in the same frame. I am using the Madrid theme, with the default color scheme. A while ago I decided to use orange blocks for questions at the end of a presentation, to set it apart from the rest of the presentation. The trouble I am running into is putting in such an orange block, then resetting the block theme back to what it was within the same frame to put in a theorem at the very end that matches the color scheme with the rest of the document. Here is what my code looks like:

Code: Select all

\begin{frame}

\setbeamercolor{block title}{bg=orange}%bg=background, fg= foreground
\setbeamercolor{block body}{fg=black}%bg=background, fg= foreground

\begin{block}{Questions!}

Some awesome questions.

\end{block}

%\setbeamercolor{block title}[bg=orange]%bg=background, fg= foreground
%\setbeamercolor{block body}{fg=black}%bg=background, fg= foreground

\begin{theorem}[Authors]
Awesome theorem to help with above questions.
\end{theorem}

\end{block} 

\end{frame}
Solutions I have been looking into are either things to add to the \setbeamercolor commands to set things back to default, or assigning the corresponding color to the block that is normally used in the theorem environment in the Madrid theme/default color scheme. For the second possible solution, I am not sure what the colors used are called, or how they are defined using the "RGB" (RBG?) color scheme.

If anyone knows anything, that would be very helpful! Thanks ^_^

~xbc
Last edited by Stefan Kottwitz on Mon Apr 30, 2012 10:33 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Defining block colors in Beamer (more than once)

Post by Stefan Kottwitz »

Hi,

this is the assignment from the orchid theme, which is loaded by the Madrid theme. You could use these lines:

Code: Select all

\setbeamercolor{block title}{use=structure,fg=white,bg=structure.fg!75!black}
\setbeamercolor{block body}{parent=normal text,use=block title,bg=block title.bg!10!bg}
Stefan
LaTeX.org admin
xbc
Posts: 6
Joined: Mon Apr 30, 2012 12:47 am

Re: Defining block colors in Beamer (more than once)

Post by xbc »

Using those lines of code worked wonderfully, thank you. :)
Post Reply