# 27  Setting a slide’s background

The background color of a Beamer slide is white by default. In the following example I will describe a few ways to change the default background.

## Setting the background to a solid color

This example shows how to set the background to a light shade of pink:

% backgrounds-demo1.tex
\documentclass{beamer}
\usetheme{default}
\setbeamercolor{normal text}{bg=red!12}
\begin{document}

\begin{frame}{Setting the background color}

$\sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}$

\end{frame}

\end{document}


See the section Blending Colors for the meaning of the color specification red!12.

## Gradient colors in the background

Gradually shaded backgrounds are possible as well. In the following example, the background varies from light red at the bottom to light yellow at the top.

% backgrounds-demo2.tex
\documentclass{beamer}
\usetheme{default}
\begin{document}

\begin{frame}{Setting the background color}

$\sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}$

\end{frame}

\end{document}


## Grid superimposed on background

An interesting effect may be achieved by superimposing a grid on the background:

% backgrounds-demo3.tex
\documentclass{beamer}
\usetheme{default}
\setbeamertemplate{background}[grid][step=5mm,color=blue]
\begin{document}

\begin{frame}{Setting the background color}

$\sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}$

\end{frame}

\end{document}


## An image for a background

The following example shows how to fill the background of a Beamer slide with the scaled version of an image using the command:14

\setbeamertemplate{background canvas}{...}


Note how I have changed the structure color and the default font color to achieve a reasonable contrast between text and background.

% backgrounds-demo4.tex
\documentclass[12pt]{beamer}
\usetheme{default}
\setbeamercolor{structure}{fg=green!30}
\setbeamercolor{normal text}{fg=green!30}
\setbeamertemplate{background canvas}{\includegraphics
[width=\paperwidth,height=\paperheight]{alps.jpg}}
\begin{document}

\begin{frame}[t]{Skiing in the Alps}

\begin{itemize}
\item Check equipment
\item Wear warm clothes
\item Pack first-aid kit
\item Good luck!
\end{itemize}

\end{frame}

\end{document}


Remark: The image file alps.jpg is not a part of Beamer; you need to supply an image of your own.

Remark: The aspect ratio of a Beamer slide is 4:3 therefore it’s best if your background image has the same aspect ratio. Otherwise your image will be distorted when it’s stretched to cover the slide from edge to edge.

Remark: To limit the background setting to a single slide, enclose the \setbeamertemplate{background canvas}{...} command in braces, as in:

{ % brace to limit the scope of \setbeamertemplate
\setbeamertemplate{background canvas}{\includegraphics
[width=\paperwidth,height=\paperheight]{alps.jpg}}
\begin{frame}[plain]
...
\end{frame}
} % closing brace


The [plain] option to \begin{frame} suppresses the drawing of any decorations that may be associated with the current theme.

Remark: Fancy background colors, shading and pictures may make your slides look pretty but they may also be distracting. Use your judgment to see if such devices are appropriate for your presentation.

14 I am indebted to Syed Irfan for correcting an earlier version of this document where I had “background” instead of “background canvas” in several places in this section.