Here's a suggestion to add a bg
option to the frame environment, such that background color can be invoked simply by adding the [bg]
option to frame
.
I have not tested this beyond the template below, put together by piecing random clues here and there. Making the actual color an argument, as in [bg=blue]
, is left as an exercices to the bored reader.
\documentclass{beamer}
\defbeamertemplate*{background canvas}{mydefault}
{%
\ifbeamercolorempty[bg]{background canvas}{}{\color{bg}\vrule width\paperwidth height\paperheight}% copied beamer default here
}
\defbeamertemplate*{background canvas}{bg}
{%
\color{lightgray!40}\vrule width\paperwidth height\paperheight% added bg color
}
\BeforeBeginEnvironment{frame}{%
\setbeamertemplate{background canvas}[mydefault]%
}
\makeatletter
\define@key{beamerframe}{bg}[true]{%
\setbeamertemplate{background canvas}[bg]%
}
\makeatother
\begin{document}
\begin{frame}
\frametitle{Normal}
\end{frame}
\begin{frame}[bg]
\frametitle{With bg}
\end{frame}
\begin{frame}
\frametitle{Normal}
\end{frame}
\end{document}
A similar thing (going off topic now) can be done with an image, instead of plain color:
\documentclass{beamer}
\usepackage{graphicx}
\usepackage{tikz}
\pgfdeclareimage[width=\paperwidth]{mybackground}{brain}
%% As an option to frame
\defbeamertemplate*{background canvas}{mydefault}
{%
\ifbeamercolorempty[bg]{background canvas}{}{\color{bg}\vrule width\paperwidth height\paperheight}% copied beamer default here
}
\defbeamertemplate*{background canvas}{image}
{%
\begin{tikzpicture}
\useasboundingbox (0,0) rectangle (\the\paperwidth, \the\paperheight);
\pgftext[at=\pgfpoint{0cm}{0cm}, left, base]{\pgfsetfillopacity{0.1}\pgfuseimage{mybackground}};
\end{tikzpicture}
}
\BeforeBeginEnvironment{frame}{%
\setbeamertemplate{background canvas}[mydefault]%
}
\makeatletter
\define@key{beamerframe}{image}[true]{%
\setbeamercovered{invisible}%
\setbeamertemplate{background canvas}[image]%
}
\makeatother%
\title[...]{My title}
\begin{document}
\begin{frame}[image]
\titlepage
\end{frame}
\section{Introduction}
\begin{frame}[plain]
Text here
\end{frame}
\end{document}