[Tex/LaTex] Beamer: background color for section page

backgroundsbeamerpresentations

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.

Best Answer

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.