3

Is it possible to change the font color of the sections in the head/foot independent from the fg/bg color of the head/foot?

edit: Here's a MWE:

\documentclass{beamer}
\useoutertheme{miniframes}
\setbeamercolor{palette tertiary}{fg=white,bg=black}

\begin{document}
\section{sec 1}
\begin{frame}
sec 1
\end{frame}

\section{sec 2}
\begin{frame}
sec 2
\end{frame}

\end{document}

If I wanted to change the color of the active section names in the header to red, the inactive section name to blue, but keep the colors black and white for the tertiary palette - how would I do that?

  • Maybe. Could you provide an example (in the form of a minimal working example (MWE)) that makes it clear which components you are referring to? – Werner Sep 23 '14 at 0:46
  • Something like \section{\protect\textcolor{red}{Section name}}? – Ignasi Sep 23 '14 at 6:29
5

This should work:

\setbeamercolor{section in head/foot}{parent=palette tertiary,fg=red}
\setbeamertemplate{section in head/foot shaded}{\color{blue}\usebeamertemplate{section in head/foot}}

Explaination

Look at the first line: It says that section in head/foot inherits colors from palette tertiary and redefine fg=red. Therefore palette tertiary remains unchanged and active section-titles are set to be red.

Similarly we want something like \setbeamercolor{section in head/foot shaded}{parent=palette tertiary,fg=blue} for inactive section-titles. Yes, we can set these colors. But no, Beamer will never use it. See the following code from beamerbasenavigation.sty:

\def\sectionentry#1#2#3#4#5{% section number, section title, page
  \ifnum#5=\c@part%
  \beamer@section@set@min@width
  \box\beamer@sectionbox\hskip1.875ex plus 1fill%
  \beamer@xpos=0\relax%
  \beamer@ypos=1\relax%
  \setbox\beamer@sectionbox=
  \hbox{\def\insertsectionhead{#2}%
    \def\insertsectionheadnumber{#1}%
    \def\insertpartheadnumber{#5}%
    {%
      \usebeamerfont{section in head/foot}\usebeamercolor[fg]{section in head/foot}%
      \ifnum\c@section=#1%
        \hyperlink{Navigation#3}{{\usebeamertemplate{section in head/foot}}}%
      \else%
        \hyperlink{Navigation#3}{{\usebeamertemplate{section in head/foot shaded}}}%
      \fi}%
  }%
  \ht\beamer@sectionbox=1.875ex%
  \dp\beamer@sectionbox=0.75ex%
  \fi\ignorespaces}

You could see that there is an \ifnum\c@section=#1 checking whether it should shade the section-title or not. However, the color theme is already applied at \usebeamercolor[fg]{section in head/foot}. Therefore \setbeamercolor{section in head/foot shaded}{parent=palette tertiary,fg=blue} is legal but useless.

But we still got one more chance: after \ifnum there is an \usebeamertemplate{section in head/foot shaded}. It is defined in beamerouterthemedefault.sty:

\defbeamertemplate*{section in head/foot shaded}{default}[1][50]
{\color{fg!#1!bg}\usebeamertemplate{section in head/foot}}

Notice that bg and fg here are the colors from section in head/foot. This explains why inactive section-titles seems to be transparent. Assigning brutally a new color at this point solves your problem.

  • 1
    This also partly solved my problem in this question: tex.stackexchange.com/questions/228256/… However, it only colors the actual section headers, not the navigation bullets. Any idea how I could fix that? – Thriveth Feb 15 '15 at 22:24
  • @Thriveth I think you could ask a separate question on this navigation bullet issue? – pluton Nov 13 '15 at 0:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.