This sort of works. \usecolortheme{foo}
uses a package beamercolorthemefoo.sty
, which is why it can only be used in the preamble. But if you neuter the commands in the .sty
file which make it a package, and \input
it instead, you can get those commands anywhere you want. So:
\documentclass{beamer}
\newenvironment{colortheme}[1]{
\def\ProvidesPackageRCS $##1${\relax}
\renewcommand{\DeclareOption[2]}{\relax}
\renewcommand{\ProcessOptions}{\relax}
\makeatletter
\input beamercolortheme#1.sty
\makeatother
}{}
\begin{document}
\begin{frame}
\begin{theorem}[Pythagoras]
If $a$ and $b$ are the legs of a right triangle and $c$ is the hypotenuse, then
\[
a^2 + b^2 = c^2
\]
\end{theorem}
\end{frame}
\begin{colortheme}{albatross}
\begin{frame}
\begin{theorem}[Pythagoras]
If $a$ and $b$ are the legs of a right triangle and $c$ is the hypotenuse, then
\[
a^2 + b^2 = c^2
\]
\end{theorem}
\end{frame}
\end{colortheme}
\begin{colortheme}{crane}
\begin{frame}
\begin{theorem}[Pythagoras]
If $a$ and $b$ are the legs of a right triangle and $c$ is the hypotenuse, then
\[
a^2 + b^2 = c^2
\]
\end{theorem}
\end{frame}
\end{colortheme}
\end{document}
The trouble is that some of the themes have optional arguments and this is going to ignore them. You would have to reprogram \DeclareOption
and \ProcessOptions
to do what you want outside of a package file. That could be possible with the pgfkeys
package.
Also, there might be other commands that are specific to packages and need to be neutered. Grepping a few of the other color theme packages I see \DeclareBeamerOption
and \ProcessBeamerOption
.
I think a nice enhancement to beamer would be to change the theme implementation so that this could be done easily. You could have \loadcolortheme{foo}
in the preamble which sets up and configures the theme, but doesn't call any of the \setbeamercolor
commands until \usecolortheme{foo}
is found. For backwards compatibility \usecolortheme
can check if the theme is loaded first.
Best Answer
You'll find a list, including images, of all the outer themes which ship with beamer, in section
16.2 Outer Themes
of the beamer user guide.Here a short overview with just the images without all the documentation between them:
Note to self:
The code for the image