How to Quickly Change Beamer Colors

Have you ever been to Frankfurt? I’ve had the pleasure of visiting Frankfurt a few times, albeit usually just through the airport. It’s the first city where I stayed in a Doppelzimmer mit Frühstück (double room with breakfast). Frankfurt is also the name of a popular theme in the LaTeX document class Beamer, which is used for making presentations (not coincidentally, Beamer is the German word for projector).

Beamer has a nice selection of themes with different layouts, but one downside is that the themes don’t offer many choices in terms of color. There’s dark blue, light blue … the yellow one … some red. But mostly blue. This can get tiring after watching three talks in a row by presenters who made their slides the night before and went with a default color scheme.

Some institutions are fortunate to have their own (un)official Beamer theme with the institution’s colors. UBC’s ECE department did not, so my quest for color began last year to replace a default Beamer blue with … UBC blue (believe me, it’s a different blue). I didn’t want to tinker too much with the underpinnings of Beamer, but I found that the generally excellent official documentation lacked some direction about what color options I could change (beyond the basics). So, a colleague and I went exploring. This post explains two ways to change Beamer colors by setting up your own custom color scheme. The first method is very quick with usecolortheme. The second method takes a little bit of tinkering with setbeamercolor, but ultimately gives you much more control.

Picking Beamer Colors

The first decision is to pick a color(s). I suggest defining two colors for variety, where one is your primary and one is your secondary. However, only one color is needed for the usecolortheme method. There are two ways to pick colors:

  • Choose from the list of known Beamer colors. By default, Beamer uses the xcolor package, so you can immediately use any of xcolor‘s pre-defined colors. As of this writing, these colors are listed in Section 2.4 of the official xcolor documentation. For example, the list includes blue, red, green, yellow, etc. A list of 68 colors is available if you load xcolor with the dvipsnames option when you load Beamer (documentclass[xcolor=dvipsnames]{beamer}).
  • Define your own custom colors. Use the definecolor command to assign a custom name and then define the parameters for your color (such as RGB values). This is handy if you want to use a very specific color, as I did.

Change Beamer Colors Method 1: usecolortheme

The command usecolortheme can be used to load any of the default Beamer color themes (as displayed here). But this post is about not using the default color themes. You can use usecolortheme with any color you want by applying the color to the structure of the presentation.

usecolortheme[named=UBCblue]{structure}

Here is a minimal example. I’ve chosen to use the Madrid theme (sorry Frankfurt) with the miniframes outer theme (to add a header) and the circles inner theme (to replace the shiny default circles).

Here is how the PDF looks:

beamer_color_example_usecolortheme_p1
usecolortheme Slide 1 of 2
beamer_color_example_usecolortheme_p2
usecolortheme Slide 2 of 2

Pro: One line of LaTeX code and you’re done.

Con: The shading of the color is automatically modified for different parts of the presentation (i.e., lighter or darker), so you don’t have full control over how the color appears. In my case, some elements are dark enough to appear black.

Change Beamer Colors Method 2: setbeamercolor

If you just want a break from the default color themes, then usecolortheme is sufficient. If you want to define exactly what colors are used, then a little more work is required (but not much). My goal was to use UBC’s official colors, so a better solution was needed.

A key find was Thierry Masson’s Beamer appearance cheat sheet. This document lists many of the properties that you can manipulate. Page 1 of the sheet lists things that you can color using setbeamercolor. You can play around with it, but here is a quick method to color your entire presentation:

  1. Set the background color of ALL FOUR palettes to your primary color. Set the foreground color of each palette to your desired text color (most likely black or white).
  2. Set the color of elements that are not defined by the palettes. You can use your primary or secondary color. This might be the hardest step and could take some trial and error to catch everything. The most important one is structure (for bullets and numbers in lists). If you have a table of contents, then you will also want to set section in toc. Anything you don’t catch will appear in the default colour theme.
  3. (optional) Select some palette elements where you would like to see the secondary color and set the color for just those elements. For example, setting subsection in head/foot to the secondary color has a nice clean appearance in themes that use a header or footer. Why not set a whole palette to the secondary color? You can, but I’ve found that you can end up with some undesirable results in headers.

Here is the same example as above but now using setbeamercolor:

And here is how the PDF looks:

beamer_color_example_setbeamercolor_p1

beamer_color_example_setbeamercolor_p2
setbeamercolor Slide 2 of 3
beamer_color_example_setbeamercolor_p3
setbeamercolor Slide 3 of 3

Pro: Much more control over how your colors are used, and can be accomplished with less than 10 added lines of code (depending on how much you want to use your secondary color).

Con: Trial and error to catch elements that still use the default color scheme. One way to speed this up visually is to call usecolortheme first to set everything to a color that has a strong contrast with the colors you want to use.

Summary

I recommend using these two methods to change Beamer colors as follows:

  • If your presentation starts in 10 minutes and you don’t want to look like you just finished your slides, use usecolortheme[named=colorname]{structure}.
  • If you want to consistently display a desired color, whether for branding or any other reason, then use setbeamercolor.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s