# How to keep a background color behind a background picture in beamer?

Forgive me if this question is easy, but I haven't found an answer.

I am trying to use photos in the background of my Beamer slides. Some of these photos do not take up the whole slide, and I'd like to have some background color other than white for the rest of the slide. Unfortunately, using tikz to set a picture seems to ensure that the background of the slide becomes white.

I'd like to make it so that this picture can go on the slide against a black background.

MWE:

\documentclass[xcolor=x11names,compress,14pt]{beamer}
\usepackage{xltxtra}
\usepackage[fallback]{xeCJK}
\usepackage{xunicode}
\usepackage{xcolor}
\usepackage{etoolbox}
\usepackage{fontspec}
\usepackage{microtype}
\usepackage{relsize}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{pdfpages}
\usetikzlibrary{backgrounds}

\setbeamercolor{normal text}{fg=white,bg=black}

\begin{document}

\begin{frame}{This Background is Black}

Text
\end{frame}

{
\usebackgroundtemplate{
\tikz[overlay,remember picture]
\node[opacity=1, at=(current page.south east),anchor=south east,inner sep=0pt,yshift=0mm,xshift=0mm]{\includegraphics[height=.95\paperheight]{OracleBone1.jpg}};
}

\begin{frame}{This Background is White}
Text
\end{frame}

\end{document}


## 1 Answer

With the help of \setbeamercolor{background canvas} and \setbeamertemplate{background} you can achieve the following:

\documentclass[compress,14pt]{beamer}
\usepackage{tikz}
\setbeamercolor{normal text}{fg=white,bg=black}

\begin{document}

\begin{frame}{This Background is Black}
Text
\end{frame}

\setbeamercolor{background canvas}{bg=black}
\setbeamertemplate{background}{\tikz[overlay,remember picture]
\node[opacity=1, at=(current page.south east),anchor=south east,inner sep=0pt,yshift=0mm,xshift=0mm]{\includegraphics[height=.95\paperheight]{example-image-1x1}};}

\begin{frame}{This Background is Black with an Image in the Corner}
Text
\end{frame}

\end{document}


Some more background information from section 8.2.7 The Background of the beamer manual:

Each frame has a background, which—as the name suggests—is “behind everything.” The background is a surprisingly complex object: in beamer, it consists of a background canvas and the main background.The background canvas can be imagined as a large area on which everything (the main background and everything else) is painted on. By default, this canvas is a big rectangle filling the whole frame whose color is the background of the beamer-color background canvas.

[...]

The main background is drawn on top of the background canvas. It can be used to add, say, a grid to everyframe or a big background picture or whatever.

• Thank you! That was easy. Aug 18, 2019 at 21:45