# 2010-11-17 Changing the color of theorems in beamer (en)

Today a friend asked me if I know a “good” method to change the color of theorems in beamer. (Obviously, this might be considered bad style—but having e.g. theorems in stronger colors than definitions, while still matching the overall style might actually be quite a good idea. I’ll definitely try using it myself some day.) So, after grepping the docs for a while, I first came up with this (less-than-optimal) solution:

\addtobeamertemplate{theorem begin}{%
\setbeamercolor{block title}{fg=red!75!black,bg=yellow!75!black}%
\setbeamercolor{block body}{fg=red,bg=yellow}%
}{}


Here, we add the commands to change the colors in the beginning of the theorem begin template (templates are a very useful tool in beamer!). Unfortunately, this won’t work as hoped: it will also affect lemmas and definitions etc.—incidentally, it won’t touch examples, which have their own template. If I want to change only, say, theorems and not definitions, it seems that some lower-level hackery is needed:

\let\OLDtheorem=\theorem
\def\theorem{%
\setbeamercolor{block title}{fg=red!75!black,bg=yellow!75!black}%
\setbeamercolor{block body}{fg=red,bg=yellow}\OLDtheorem
}


Granted this is a bit ugly—but it works fine. (Notice also the color definitions: it is the xcolor package which allows for color declarations like “75% of red and 25% of black” like here.)