2

In my TOC I would like to highlight the current section using a different color. Following the answers to this question, I have managed to change the text color of the current section using

\setbeamercolor{section in toc}{fg=alerted text.fg, fg = red}

Now I also want to change the bullet color of the current section, but so far I've only managed to change to color of all the bullets in the TOC. How can I change the color of the current section bullet in the TOC?

Here's a MWE:

\documentclass[xcolor=dvipsnames]{beamer}
\usecolortheme{dolphin} 
\useinnertheme{rectangles} % adds squared bullets to TOC

% Define colors of our university
\definecolor{UniGreen}{RGB}{ 0,139,0}
\definecolor{TitleGreen}{RGB}{0,120,0}
\setbeamercolor{title}{fg=TitleGreen}
\setbeamercolor{structure}{fg=UniGreen} 
\setbeamercolor{item projected}{bg=UniGreen, fg=white} %define color of the item-bullets
\setbeamercolor{button}{bg=UniGreen}


\AtBeginSection[]
{
\setbeamercolor{section in toc}{fg=alerted text.fg, fg = red} % this changes name of current section to red as desired
\setbeamercolor{section in toc shaded}{bg=structure!20, fg=structure}
\setbeamertemplate{section in toc shaded}[default][100]
\setbeamercolor{section number projected}{fg=alerted, bg=red,fg=white} % THIS LINE OF CODE CHANGES ALL THE BULLETS IN THE TOC TO RED
}

\begin{document}
\section{Test section one}
\begin{frame} test \end{frame}
\section{Test section two}
\begin{frame} test \end{frame}

\frame{\frametitle{Outline}\tableofcontents[currentsection, currentsubsection, subsectionstyle = show, subsubsectionstyle=show]
} 

\section{Test section three}
\begin{frame} test \end{frame}
\section{Test section four}
\begin{frame} test \end{frame}

\end{document}
0

It seems from what I found, it is not possible to achieve your desired behavior solely by redefining colors. Therefore my suggestion is to redefine the section in toc template. To do this, have a look into your inner theme, which is rectangles and by itself only loads \setbeamertemplate{sections/subsections in toc}[square] so checkout beamerbaseauxtemplates.sty for the original definition and then use it as a basis for our square_special template, which looks as follows:

\defbeamertemplate*{section in toc}{square_special}
{\leavevmode\leftskip=1.75ex%
    \llap{%
        \usebeamerfont*{section number projected}%
        %\usebeamercolor[bg]{section number projected}%
        \vrule width2.25ex height1.85ex depth.4ex%
        \hskip-2.25ex%
        \hbox to2.25ex{\hfil\usebeamercolor[fg]{section number projected}\inserttocsectionnumber\hfil}}%
    \kern1.25ex\inserttocsection\par}

What did I do here? Well I removed the original selection of the background color for the section number projected and just use the already installed color (the one for the section title. However we still need the fg color of section number projected.

This is how it looks in your MWE:

\documentclass[xcolor=dvipsnames]{beamer}
\usecolortheme{dolphin} 
\useinnertheme{rectangles} % adds squared bullets to TOC

% Define colors of our university
\definecolor{UniGreen}{RGB}{ 0,139,0}
\definecolor{TitleGreen}{RGB}{0,120,0}
\setbeamercolor{title}{fg=TitleGreen}
\setbeamercolor{structure}{fg=UniGreen} 
\setbeamercolor{item projected}{bg=UniGreen, fg=white} %define color of the item-bullets
\setbeamercolor{button}{bg=UniGreen}


\AtBeginSection[]
{
    \setbeamercolor{section in toc}{fg=alerted text.fg, fg = red} % this changes name of current section to red as desired
    \setbeamercolor{section in toc shaded}{bg=structure!20, fg=structure}
    \setbeamertemplate{section in toc shaded}[default][100]
    \setbeamercolor{section number projected}{fg=alerted, bg=red,fg=white} % THIS LINE OF CODE CHANGES ALL THE BULLETS IN THE TOC TO RED
}

\defbeamertemplate*{section in toc}{square_special}
{\leavevmode\leftskip=1.75ex%
    \llap{%
        \usebeamerfont*{section number projected}%
        %\usebeamercolor[bg]{section number projected}%
        \vrule width2.25ex height1.85ex depth.4ex%
        \hskip-2.25ex%
        \hbox to2.25ex{\hfil\usebeamercolor[fg]{section number projected}\inserttocsectionnumber\hfil}}%
    \kern1.25ex\inserttocsection\par}

\begin{document}
    \section{Test section one}
    \begin{frame} test \end{frame}
\section{Test section two}
\begin{frame} test \end{frame}

\frame{\frametitle{Outline}\tableofcontents[currentsection, currentsubsection, subsectionstyle = show, subsubsectionstyle=show]
} 

\section{Test section three}
\begin{frame} test \end{frame}
\section{Test section four}
\begin{frame} test \end{frame}

\end{document}

In general I would recommend some more simplifications, but I guess they are needed for your theme to work. This is how the Outline looks in my solution:

enter image description here

| improve this answer | |

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.