I've got a background in my custom template which I'd like to be able to switch off for certain slides. Ideally I'd do this with an option to \begin{frame}. My template is very loosely based on the approach in Claudio Fiandrino's answer to "Design a custom Beamer theme from scratch".
I've seen How to insert a background image in a beamer frame? and How to include a background image to only one page of a beamer presentation?; what I'm looking for is essentially the reverse of the latter, but cleanly (if I get this template right I won't be the only one using it so I wan't it to be robust).
This ends up being quite a lot of code just for an MWE. The most relevant bit is probably first, in beaminnerthemecf.sty:
\mode<presentation>
\setbeamertemplate{background}{
\begin{tikzpicture}
\useasboundingbox[inner sep=0] (0,0) rectangle(\paperwidth,\paperheight);
\node[anchor=north,opacity=0.25] (bkg) at (current page.north) {\includegraphics[width=\paperwidth,height=\paperheight]{example-image-a}};
\fill[color=red,anchor=north west] (0,\the\paperheight) rectangle(\the\paperwidth,0.85\paperheight);
\node[anchor= south east, red,align=right] at (0.975\paperwidth,0.025\paperheight){\normalsize\insertauthor\\[0.2em]\normalsize\insertdate};
\ifnum\thepage>1\relax%
\ifx\insertframesubtitle\@empty%
{\node[anchor=north west, white,font=\Large] at (0.025\paperwidth,0.975\paperheight){\insertframetitle};}
\else{%
\node[anchor=north west, white,font=\Large] at (0.025\paperwidth,0.985\paperheight){\insertframetitle};%
\node[anchor=north west, white,font=\large] at (0.025\paperwidth,0.925\paperheight){\insertframesubtitle};%
}%
\fi
\fi
\end{tikzpicture}
}
% Title page
\defbeamertemplate*{title page}{cf}[1][]{%
\begin{tikzpicture}[overlay, remember picture, shift={(current page.south west)}]
\useasboundingbox (current page.south west) rectangle(\paperwidth,\paperheight);
\node[anchor=center, red,inner sep=0,align=center,text width=0.8\paperwidth] at (0.5\paperwidth,0.5\paperheight){\inserttitle};
\end{tikzpicture}
}
% Items
\setbeamertemplate{items}[square]
\setbeamertemplate{sections/subsections in toc}[square]
\mode<all>
to test it we can compile dummy.tex:
\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\title{\Large{\textbf{There Is No Largest Prime Number}}}
\date[ISPN ’80]{27th International Symposium of Prime Numbers}
\author[Euclid]{Euclid of Alexandria \texttt{euclid@alexandria.edu}}
\usetheme{cf}
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\begin{frame} % This is where I'd like to turn off the background image
\frametitle{There Is No Largest Prime Number}
\framesubtitle{The proof uses \textit{reductio ad absurdum}.}
This is a test
\begin{enumerate}
\item Suppose $p$ were the largest prime number.
\item Let $q$ be the product of the first $p$ numbers.
\item Then $q+1$ is not divisible by any of them.
\item But $q + 1$ is greater than $1$, thus divisible by some prime
number not in the first $p$ numbers.
\end{enumerate}
\end{frame}
\end{document}
Also needed are beamerouterthemecf.sty:
\mode<presentation>
% Frame title
\defbeamertemplate*{frametitle}{cf}[1][]{
}
\mode<all>
and beamercolorthemecf.sty:
\mode<presentation>
% Settings
\setbeamercolor*{title page header}{fg=white}
\setbeamercolor*{author}{fg=white}
\setbeamercolor*{date}{fg=white}
\setbeamercolor*{item}{fg=red}
\setbeamercolor*{normal text}{fg=black}
\mode<all>
