Latex beamer change color scheme

beamer ’s color management allows you to specify the color of every element (like, say, the color of the section entries in a table of contents or, say, the color of the subsection entries in a mini table of contents in a sidebar). While the system is quite powerful, it is not trivial to use. To simplify the usage of the color system, you should consider using a predefined color theme, which takes care of everything for you.

In the following, color themes are explained first. The rest of the section consists of explanations of how the color management works internally. You will need to read these sections only if you wish to write your own color themes; or if you are quite happy with the predefined themes but you absolutely insist that displayed mathematical text simply has to be typeset in a lovely pink.

17.1 Color Themes ¶

In order to also show the effect of the different color themes on the sidebar, in the following examples the color themes are used together with the outer theme sidebar .

17.1.1 Default and Special-Purpose Color Themes ¶

The default color theme is very sober. It installs little special colors and even less backgrounds. The default color theme sets up the default parent relations between the different beamer -colors.

The main colors set in the default color theme are the following:

Use this theme for a no-nonsense presentation. Since this theme is loaded by default, you cannot “reload” it after having loaded another color theme.

\usecolortheme [ ⟨ options ⟩ ]

The example was created using \usecolortheme[named=SeaGreen] .

This theme offers a convenient way of changing the color used for structural elements. More precisely, it just changes the foreground of the beamer -color structure . You can also achieve this by directly invoking the function \setbeamercolor , but this color theme makes things a bit easier.

The theme offers several ⟨ options ⟩ , which can be used to specify the color to be used for structural elements:

This theme changes the colors in a sidebar such that the current entry in a table of contents shown there gets highlighted by showing a different background behind it.

17.1.2 Complete Color Themes ¶

A “complete” color theme is a color theme that completely specifies all colors for all parts of a frame. It installs specific colors and does not derive the colors from, say, the structure beamer -color. Complete color themes happen to have names of flying animals.

The color theme is a “dark” or “inverted” theme using yellow on blue as the main colors. The color theme also installs a slightly darker background color for blocks, which is necessary for presentation themes that use shadows, but which (in Till’s opinion) is undesirable for all other presentation themes. By using the lily color theme together with this theme, the backgrounds for blocks can be removed.

When using a light-on-dark theme like this one, be aware that there are certain disadvantages:

On the other hand, a light-on-dark presentation often appears to be more “stylish” than a plain black-on-white one.

The following ⟨ options ⟩ may be given:

Example: The overlystylish option together with the lily color theme:

The main “theme behind this theme” is to use white and black text on gray background. The white text is used for special emphasis, the black text for normal text. The “outer stuff” like the headline and the footline use, however, a bluish color. To change this color, change the background of palette primary .

Great care must be taken with this theme since both the white/gray and the black/gray contrasts are much lower than with other themes. Make sure that the contrast is high enough for the actual presentation.

You can change the “grayish” background by changing the background of normal text .

This theme uses the colors of Lufthansa, whose logo is a crane. It is not an official theme by that company, however.

This theme is nearly a black and white theme and useful for creating presentations that are easy to print on a black-and-white printer. The theme uses grayscale in certain unavoidable cases, but never color. It also changes the font of alerted text to boldface.

When using this theme, you should consider using the class option gray , which ensures that all colors are converted to grayscale. Also consider using the structurebold font theme.

This theme is the “consequent” version of beetle and uses white/black/gray throughout. It does not go particularly well with themes that use shadows.

The theme is based on the colors of the Monarch butterfly.

Theme author: Max Dohse.

Like the dove color theme, this theme is useful for printing on a black-and-white printer. However, it uses different shades of gray extensively, which may or may not look good on a transparency.

The theme is based on the colors of the University of Michigan’s mascot, a wolverine.

Theme author: Madhusudan Singh.

The theme is based on the colors of MIT’s mascot, a beaver.

Theme author: Madhusudan Singh.

The theme is based on the colors of Michigan State University.

Theme author: Alan Munn.

17.1.3 Inner Color Themes ¶

Inner color themes only specify the colors of elements used in inner themes. Most noticeably, they specify the colors used for blocks. They can be used together with other (color) themes. If they are used to change the inner colors installed by a presentation theme or another color theme, they should obviously be specified after the other theme has been loaded. Inner color themes happen to have flower names.

This theme is mainly used to uninstall any block colors setup by another theme, restoring the colors used in the default theme. In particular, using this theme will remove all background colors for blocks.

This theme installs white-on-dark block titles. The background of the title of a normal block is set to the foreground of the structure color, the foreground is set to white. The background of alerted blocks are set to red and of example blocks to green. The body of blocks get a nearly transparent background.

This theme installs nearly transparent backgrounds for both block titles and block bodies. This theme is much less “aggressive” than the orchid theme. The background colors are derived from the foreground of the structure beamer -color.

17.1.4 Outer Color Themes ¶

An outer color theme changes the palette colors, on which the colors used in the headline, footline, and sidebar are based by default. Outer color themes normally do not change the color of inner elements, except possibly for titlelike . They happen to be sea-animal names.

Installs a white-on-dark palette for the headline, footline, and sidebar. The backgrounds used there are set to shades between the structure beamer -color and black. The foreground is set to white.

While this color theme can appear to be aggressive, you should note that a dark bar at the border of a frame will have a somewhat different appearance during a presentation than it has on paper: During a presentation the projection on the wall is usually surrounded by blackness. Thus, a dark bar will not create a contrast as opposed to the way it does on paper. Indeed, using this theme will cause the main part of the frame to be more at the focus of attention.

The counterpart to the theme with respect to blocks is the orchid theme. However, pairing it with the rose color theme is also interesting.

Installs a near-transparent backgrounds for the headline, footline, and sidebar. Using this theme will cause navigational elements to be much less “dominant” than when using the whale theme (see the discussion on contrast there, though).

It goes well with the rose or the lily color theme. Pairing it with the orchid overemphasizes blocks (in Till’s opinion).

A color theme somewhere in the middle between the whale and the seahorse. It was graciously donated by Manuel Carro. Like the seahorse, it goes well with the rose and the lily color theme.

17.2 Changing the Colors Used for Different Elements of a Presentation ¶

This section explains how beamer ’s color management works.

17.2.1 Overview of Beamer’s Color Management ¶

In beamer ’s philosophy, every element of a presentation can have a different color. Unfortunately, it turned out that simply assigning a single color to every element of a presentation is not such a good idea. First of all, we sometimes want colors of elements to change during a presentation, like the color of the item indicators when they become alerted or inside an example block. Second, some elements naturally have two colors, namely a foreground and a background, but not always. Third, sometimes elements somehow should not have any special color but should simply “run along” with the color of their surrounding. Finally, giving a special color to every element makes it very hard to globally change colors (like changing all the different kind-of-blue things into kind-of-red things) and it makes later extensions even harder.

For all these reasons, the color of an element in beamer is a structured object, which we call a beamer -color . Every beamer -color has two parts: a foreground and a background. Either of these may be “empty,” which means that whatever foreground or background was active before should remain active when the color is used.

beamer -colors can inherit from other beamer -colors and the default themes make extensive use of this feature. For example, there is a beamer -color called structure and all sorts of elements inherit from this color. Thus, if someone changes structure , the color of all these elements automatically change accordingly. When a color inherits from another color, it can nevertheless still override only the foreground or the background.

It is also possible to “inherit” from another beamer -color in a more sophisticated way, which is more like using the other beamer -color in an indirect way. You can specify that, say, the background of the title should be a 90% of the background of normal text and 10% of the foreground of structure .

Inheritance and using of other beamer -colors is done dynamically. This means that if one of the parent beamer -colors changes during the presentation, the derived colors automatically also change.

The default color theme, which is always loaded, installs numerous beamer -colors and inheritance relations between them. These colors are explained throughout this guide. The color used for, say, frametitles is discussed in the section on frametitles, and so on.

17.2.2 Using Beamer’s Colors ¶

A beamer -color is not a normal color as defined by the color and xcolor packages and, accordingly, cannot be used directly as in commands like \color or \colorlet . Instead, in order to use a beamer -color, you should first call the command \usebeamercolor , which is explained below. This command will setup two (normal) colors called fg (for foreground) and bg (for, well, guess what). You can then say \color to install the foreground color and \color to install the background color. You can also use the colors fg and bg in any context in which you normally use a color like, say, red . If a beamer -color does not have a foreground or a background, the colors fg or bg (or both) remain unchanged.

Inside templates, this command will typically have already been called for you with the option [fg] .

This command (possibly) changes the two colors fg and bg to the foreground and background color of the ⟨ beamer-color name ⟩ . If the beamer -color does not specify a foreground, fg is left unchanged; if does not specify a background, bg is left unchanged.

You will often wish to directly use the color fg or bg after using this command. For this common situation, the optional argument ⟨ fg or bg ⟩ is useful, which may be either fg or bg . Giving this option will cause the foreground fg or the background bg to be immediately installed after they have been setup. Thus, the following command

is a shortcut for

If you use the starred version of this command, the beamer -color normal text is used before the command is invoked. This ensures that, barring evil trickery, the colors fg and bg will be setup independently of whatever colors happened to be in use when the command is invoked.

This command has special side-effects. First, the (normal) color parent.bg is set to the value of bg prior to this call. Thus you can access the color that was in use prior to the call of this command via the color parent.bg .

Second, the special color ⟨ beamer-color name ⟩ .fg is globally set to the same value as fg and ⟨ beamer-color name ⟩ .bg is globally set to the value of bg . This allows you to access the foreground or background of a certain ⟨ beamer-color name ⟩ after another beamer -color has been used. However, referring to these special global colors should be kept to the unavoidable minimum and should be done as locally as possible since a change of the beamer -color will not reflect in a change of the colors ⟨ beamer-color name ⟩ .fg and ⟨ beamer-color name ⟩ .bg until the next invocation of \usebeamercolor . Also, if the ⟨ beamer-color name ⟩ does not specify a foreground or a background color, then the values of the special colors are whatever happened to be the foreground or background at the time of the last invocation of \usebeamercolor .

So, try not to get into the habit of writing \color all the time, at least not without a \usebeamercolor close by.

This text is <\usebeamercolor[fg]alerted>. The following box uses the fore- and background of frametitles: < \usebeamercolor[fg]\colorbox >

This command has no effect in article mode.

This command can be used to check whether the foreground or background of some ⟨ beamer-color name ⟩ is non-empty. If the foreground or background of ⟨ beamer-color name ⟩ is defined, ⟨ if defined ⟩ will be executed, otherwise the ⟨ if undefined ⟩ code.

17.2.3 Setting Beamer’s Colors ¶

To set or to change a beamer -color, you can use the command \setbeamercolor .

Sets or changes a beamer -color. The ⟨ beamer-color name ⟩ should be a reasonably simple text (do not try too much trickery and avoid punctuation symbols), but it may contain spaces. Thus, normal text is a valid ⟨ beamer-color name ⟩ and so is My Color Number 2 .

In the most simple case, you just specify a foreground by giving the fg= option and, possibly, also a background using the bg= option.

Example: \setbeamercolor

Example: \setbeamercolor

The effect of this command is accumulative, thus the following two commands

have the same effect as

Naturally, a second call with the same kind of ⟨ option ⟩ set to a different value overrides a previous call.

The starred version first resets everything, thereby “switching off” the accumulative effect. Use this starred version to completely reset the definition of some beamer -color.

The following ⟨ options ⟩ may be given:

However, this will not necessarily give the desired result: If the beamer -color structure changes, the (normal) color structure.fg is not immediately updated. In order to ensure that the normal color structure.fg is correct, use the following: \setbeamercolor,fg=structure.fg!50!normal text.fg>

This will guarantee that the colors structure.fg and normal text.fg are setup correctly when the foreground of item is computed. To show the difference, consider the following example: \setbeamercolor \setbeamercolor \setbeamercolor> \setbeamercolor < \usebeamercolor\usebeamercolor %% Defines father.fg and mother.fg globally > \setbeamercolor \setbeamercolor,fg=father.fg!50!mother.fg> <\usebeamercolor[fg]dark red text> <\usebeamercolor[fg]also dark red text> \setbeamercolor <\usebeamercolor[fg]still dark red text> <\usebeamercolor[fg]now dark green text>

17.3 The Color of Mathematical Text ¶

By default, mathematical text does not have any special color—it just inherits the “surrounding” color. Some people prefer mathematical text to have some special color. Though we do not recommend this (we believe mathematical text should not stand out amid the normal text), beamer makes it (reasonably) easy to change the color of mathematical text. Simply change the following colors:

Beamer-Color math text

This color is the parent of math text inlined and math text displayed . It is empty by default. See those colors for details.

Beamer-Color math text inlined

Color parents: math text

If the foreground of this color is set, inlined mathematical text is typeset using this color. This is done via some \everymath hackery and may not work in all cases. If not, you’ll have to try to find a way around the problem. The background is currently ignored.

Beamer-Color math text displayed

Color parents: math text

Like math text inlined , only for so-called “displayed” mathematical text. This is mathematical text between \[ and \] or between $$ and $$ or inside environments like equation or align . The setup of this color is somewhat fragile, use at your own risk. The background is currently ignored.

Beamer-Color normal text in math text

If the foreground of this color is set, normal text inside mathematical text (which is introduced using the \text command) will be typeset using this color. The background is currently ignored.

17.4 The Color Palettes ¶

When one designs a color theme, one faces the following problem: Suppose we want the colors in the headline to gradually change from black to, say, blue. Whatever is at the very top of the headline should be black, what comes right below it should be dark blue, and at the bottom of the headline things should just be blue. Unfortunately, different outer themes will put different things at the top. One theme might put the author at the top, another theme might put the document title there. This makes it impossible to directly assign one of the three colors “black”, “dark blue,” and “blue” to the different elements that are typically rendered in the headline. No matter how we assign them, things will look wrong for certain outer themes.

To circumvent this problem, beamer uses a layer of palette colors. Color themes typically only change these palette colors. For example, a color theme might make the beamer -color palette primary blue, make palette secondary a dark blue, and make palette tertiary black. Outer themes can now setup things such that whatever they show at the top of the headline inherits from palette primary , what comes below inherits from palette secondary , and whatever is at the bottom inherits from palette tertiary . This way, color themes can change the way even complicated outer themes look and they can do so consistently.

Note that the user can still change the color of every element individually, simply by overriding the color(s) of the elements in the headline. In a sense, the palette colors are just a “suggestion” how things should be colored by an outer theme.

In detail, the following palette colors are used by outer themes.

Beamer-Color palette primary

Outer themes (should) base the color of navigational elements and, possibly, also of other elements, on the four palette colors. The “primary” palette should be used for the most important navigational elements, which are usually the ones that change most often and hence require the most attention by the audience. The “secondary” and “tertiary” are less important, the “quaternary” one is the least important.

By default, the palette colors do not have a background and the foreground ranges from structure.fg to black .

For the sidebar, there is an extra set of palette colors, see palette sidebar primary .

Beamer-Color palette secondary