[Tex/LaTex] Beamer: define a backgroung color for the “part page” frames

backgroundsbeamertitles

I'm trying to make a .sty template, but I cannot figure out how to define a dedicated background canvas for the "part page" frames.

Here (How to add background only to title frame and an other only to the last frame?) is a solution for when it is possible to characterize the background depending on the frame number, but it cannot be applied in my situation.

So is there a way to test the "type" of frame? (like "title page", "part page", …). If yes, it means I can do the same as the solution to sandoche's problem. If not, can anybody think of a workaround?

Best Answer

As far as I know, the background canvas is drawn before the actual contents of the frame are read. So in \frame{\partpage}, the background is drawn before beamer sees the \partpage and can realize that the frame is a part page.

If you want a \frame{\partpage} immediately after every \part{}, then you can simply hook into \AtBeginPart:

\documentclass{beamer}

\AtBeginPart{%
    {%  start a group to keep the template change local
        \setbeamertemplate{background canvas}{%
            \color{red!50}\rule{\paperwidth}{\paperheight}%
        }%
        \frame{\partpage}%
    }%  end group
}

\begin{document}
\part{The first part}
\frame{...}
\frame{...}
\part{The second part}
\frame{...}
\frame{...}
\end{document}

result