[Tex/LaTex] beamer: Create a Custom Frametitle Color for Specific Frames

beamer

  • I have a complex presentation where I use different background graphics.
  • Due to reliability, I need to have a different frametitle color for some specific frames (e. g. overview frame).
  • I tried to define a new color and apply it in the \frametitle command which didn't work.
  • If I use e. g. \color{blue} directly then it works.
  • What am I missing? I want to use the beamer syntax and framework.
  • In addition, where is the \frametitle command defined? I wanted to create something like \usebeamertemplate{frametitle}[Overview] (as I do for the background canvas) but I can't figure it out.
  • I do not want to manually change it because I want to create a theme and therefore I do not want to have to change the content frames manually.

enter image description here

\documentclass[]{beamer}

\setbeamercolor{structure}{fg=red}
\setbeamercolor{myOwnColorForTheOverviewFrameTitle}{fg=blue}

\begin{document}

\begin{frame}[plain]
% Here I try to apply a different color for a spefific frame
\frametitle{\usebeamercolor{myOwnColorForTheOverviewFrameTitle}Overview}
\tableofcontents
\end{frame}

\section{Section 1}

\begin{frame}
\frametitle{Frame Title 1}
Test
\end{frame}

\section{Section 2}

\begin{frame}
\frametitle{Frame Title 2}
Test
\end{frame}

\end{document}

Best Answer

I would not use formatting commands inside macros such as \frametitle, as this is a task for templates. To simply change the colour, you could change the beamercolor locally for the frame.

In case you want to do more complex changes, define your own frametitle template, examples can be found in the outer themes.

\documentclass[]{beamer}

\setbeamercolor{structure}{fg=red}
\setbeamercolor{myOwnColorForTheOverviewFrameTitle}{fg=blue}

\begin{document}


{
    \setbeamercolor{frametitle}{parent=myOwnColorForTheOverviewFrameTitle}
    \begin{frame}[plain]
    \frametitle{Overview}
    \tableofcontents
    \end{frame}
}

\section{Section 1}

\begin{frame}
\frametitle{Frame Title 1}
Test
\end{frame}

\section{Section 2}

\begin{frame}
\frametitle{Frame Title 2}
Test
\end{frame}

\end{document}

enter image description here

Related Question