4

In my Latex (sharelatex) beamer document, I do have a

\section{Section Title}

for showing a section. In the *.sty, sections are defined as

% begin Sections -

\if@doSectionPage\@empty 
\else
% Insert frame with section title at every section start
\AtBeginSection[]
{
  \begingroup
  \setbeamercolor{background canvas}{bg=blue_background}
  \begin{frame}[plain]
    \vspace{2em}\usebeamerfont{section title}
    \progressbar@progressbar%
  \end{frame}
 \endgroup
}
\fi

% end Sections

  1. I wonder if it's possible to switch background colors of sections, according to a pre-defined theme. Something like

    \section[blue_background]{Section Title} or
    \section[red_background]{Section Title}
    
  2. Also, is it possible to define a white font for slides with dark background (black) and a dark font for slides with bright (white) background?

2
  • 1
    \colorbox{blue}{text}will change the background-colour of the text, and \textcolor{red}{text}or \color{red} will change the color of the text itself, if that is what you mean.
    – Runar
    Jun 20, 2016 at 13:45
  • Can you please make a complete minimal working example (MWE)? Which theme are you using, where does this \progressbar@progressbar% command come from? Oct 8, 2016 at 18:14

1 Answer 1

5

You could define your own command for creating sections. As for your second questions, determining if a colour is dark or bright might be difficult, but maybe just taking the compliment colour might be a quick workaround:

\documentclass{beamer}

\newcommand{\mysection}[2][blue]{%
    \begingroup
    \setbeamercolor{background canvas}{bg=#1}
    \setbeamercolor{section title}{fg=-#1}
    \section{#2}
    \begin{frame}[plain]
      \vspace{2em}\usebeamercolor[fg]{section title}\usebeamerfont{section title}
      bla
    \end{frame}
    \endgroup
}

\begin{document}

\mysection[blue]{blue section}
\begin{frame}
    abc
\end{frame} 

\mysection[red]{red section}
\begin{frame}
    abc
\end{frame} 

\mysection{default colour}
\begin{frame}
    abc
\end{frame}     

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .