# beamer color settings for section names in the header

This guide explains how to produce dynamic headers, where the current section is highlighted.

But how can I control the color used for highlighting? (to save space I've set the header's font size to a small value, so I would like to add some contrast to make it more clear in what section of the talk we are).

-
Welcome to TeX.sx! It's not necessary to sign your questions (as there is already a box with your username below it) or to begin them with a greeting. A suggestion: Change your username to something more telling than "user1933". –  henrique Sep 21 '12 at 12:39

If I understood your question correctly, here's a possible solution; I added a colored framed around the section titles in the both the general ToC and in the ToCs generated at the beginning of each section:

\documentclass{beamer}
\usepackage{tikz}
\usetheme{Malmoe}

\newcommand\sectioncolor{white}

\newcommand\SectionBox[1]{%
\tikz\node[rectangle,fill=\sectioncolor,rounded corners] {#1};
}

\AtBeginSection{%
\setbeamercolor{section in toc}{fg=black,bg=\sectioncolor}
\begin{frame}<beamer>
\frametitle{Outline \thesection}
\end{frame}
}

\makeatletter
\long\def\beamer@section[#1]#2{%
\beamer@savemode%
\mode<all>%
\ifbeamer@inlecture
\refstepcounter{section}%
\renewcommand\sectioncolor{%
\ifcase\value{section}\or blue!20\or green!80!black\or red!80!black!50\or yellow!30!black!50\else orange!30!black!50\fi}
\beamer@ifempty{#2}%
{\long\def\secname{#1}\long\def\lastsection{#1}}%
\long\def\secname{#2}%
\long\def\lastsection{#1}%
{\protect\tikz\protect\node[rectangle,fill=\sectioncolor,rounded corners] {#2};}%
{\the\c@page}{\the\c@part}%
{\the\beamer@tocsectionnumber}}}%
\beamer@ifempty{#1}{}{%
}%
\beamer@sectionstartpage=\c@page%
\beamer@subsectionstartpage=\c@page%
\def\insertsubsection{}%
\def\insertsubsubsection{}%
\def\lastsubsection{}%
\Hy@writebookmark{\the\c@section}{\secname}{Outline\the\c@part.\the\c@section}{2}{toc}%
\hyper@anchorstart{Outline\the\c@part.\the\c@section}\hyper@anchorend%
\beamer@ifempty{#2}{\beamer@atbeginsections}{\beamer@atbeginsection}%
\fi%
\beamer@resumemode}%
\makeatother

\begin{document}

\begin{frame}
\frametitle{General Outline}
\tableofcontents
\end{frame}

\section{Test Section One}
\subsection{Test Subsection One One}
\begin{frame}test one\end{frame}
\subsection{Test Subsection One Two}
\begin{frame}test one\end{frame}

\section{Test Section Two}
\subsection{Test Subsection Two One}
\begin{frame}test one\end{frame}
\subsection{Test Subsection Two Two}
\begin{frame}test one\end{frame}
\subsection{Test Subsection Two Three}
\begin{frame}test one\end{frame}

\section{Test Section Three}
\subsection{Test Subsection Three One}
\begin{frame}test one\end{frame}
\subsection{Test Subsection Three Two}
\begin{frame}test one\end{frame}

\end{document}


The general ToC:

Two of the ToCs at the beginning of sections:

Since the modification is required for the sections in the navigation bar and not in the ToCs as I initially thought, the solution is much easier: all that is requierd is to redefine the templates section in head/foot (for the current section) and section in head/foot shaded (for sections different from the current one). In the following example I used a colored frame for the current section, but you can use any other style you like:

\documentclass{beamer}
\usepackage{tikz}
\usetheme{Singapore}

\definecolor{SectionBox}{RGB}{60,160,0}

\begin{document}

\section{Test Section One}
\subsection{Test Subsection One One}
\begin{frame}test section one\end{frame}
\subsection{Test Subsection One Two}
\begin{frame}test section  one\end{frame}

\section{Test Section Two}
\subsection{Test Subsection Two One}
\begin{frame}test section  two\end{frame}
\subsection{Test Subsection Two Two}
\begin{frame}test section  two\end{frame}
\subsection{Test Subsection Two Three}
\begin{frame}test  section  two\end{frame}

\section{Test Section Three}
\subsection{Test Subsection Three One}
\begin{frame}test section  three\end{frame}
\subsection{Test Subsection Three Two}
\begin{frame}test section  three\end{frame}

\end{document}


Some images of some of the headlines:

-
Thanks. Sadly my question was not clearly formulated it seems. I meant in the header. For example, the part that in your example is now white on black background ("text section two") I wanted red on black background. –  user1933 Aug 23 '12 at 7:54
@user1933 Then perhaps you should edit the title of your question and dellete \tableofcontents[] to remove ambiguity. In some time I will then give you a possible solution for the sections in the navigation bar. –  Gonzalo Medina Aug 23 '12 at 12:14
@user1933 I updated my answer providing a possible solution for the sections in the navigation bar. Although now it's not necessary, I will leave the other part of the answer (the one with the modifications to the ToCs) here since it can be useful, if that's OK with you. –  Gonzalo Medina Aug 23 '12 at 14:12
yes! Thanks. I could also repost a specific question for table of content, to host the first part of your answer there if you so wish: just let me know. –  user1933 Aug 23 '12 at 14:26
@user1933 You're welcome! Hmm, I don't know what to do about the possibility of opening the other question. Maybe not? I think it's not really necessary; thanks, anyway. –  Gonzalo Medina Aug 23 '12 at 14:43