# Beamer: background color for section page?

I have defined a beamer template for a section page:

\setbeamertemplate{section page}
{

\begin{centering}
\usebeamercolor[fg]{section title}
\usebeamerfont{section title}
\insertsection
\par
\end{centering}
}


which I make appear at the beginning of each section:

\AtBeginSection{\frame{\sectionpage}}


Given that the background canvas of a frame has to be set before beginning the frame, is there any way to extend the template to include a background color for section pages?

What I'm doing right now is for every section:

\begingroup
\setbeamercolor{background canvas}{bg=mySectionBackgroundColor}
\section{Content}
\endgroup


But I would like to just do:

\section{Content}


and have the background color set as part of the template.

You can set the background color inside the \AtBeginSection:

\AtBeginSection{
\begingroup
\setbeamercolor{background canvas}{bg=blue}
\frame{\sectionpage}
\endgroup
}


Then

\section{Content}


should give you a blue page.

Alternatively we could create the actual \frame inside the template:

\setbeamertemplate{section page}
{
\setbeamercolor{background canvas}{bg=blue}
\frame{
\begin{centering}
\usebeamercolor[fg]{section title}
\usebeamerfont{section title}
\insertsection
\par
\end{centering}
}
}


making the "grouping" obsolete:

\AtBeginSection{\sectionpage}


Additionally we can now create an \usebackgroundtemplate for section pages.