matze / mtheme

A modern LaTeX Beamer theme
6.38k stars 843 forks source link

How to change color of inverted section pages? #400

Open camayl opened 8 months ago

camayl commented 8 months ago

I am using the following, to get inverted color section pages:

\AtBeginSection{
  {
    \metroset{background=dark}
    \frame[plain,c,noframenumbering]{\sectionpage}
  }
}

At the sametime I am using a custom color, call it maincolor. maincolor applied to the frame titles, but somehow the inverted section page background is still in dark teal (the original mtheme color). How can I change this? Thanks!

kir0ul commented 8 months ago

Not sure what you're trying to do with the \AtBeginSection{} command, but I believe you can just use \usetheme[background=dark]{metropolis} to get inverted colors.

You can do something like that to change the original dark teal color:

\documentclass[10pt]{beamer}

\usetheme{metropolis}

\definecolor{maincolor}{HTML}{138a07}
\setbeamercolor{normal text}{%
    % bg=,
    fg=maincolor
}

\begin{document}

\begin{frame}{Metropolis test}
    \begin{itemize}
        \item Test 1
        \item Test 2
    \end{itemize}
\end{frame}

\end{document}

image

The annoying thing is that this color is the same for the background of the title and for the text color inside the slide.

camayl commented 8 months ago

TL;DR: changing the name of color mDarkTeal to maincolor somehow seems to break my setup.

Thank you so much for your help. Ok I realised what is not working. Let me explain.

So what my snippet (which I found online) does, is give me "inverted" section slides at the beginning of each section, looking like this: Screenshot 2024-02-06 032124.

Additionally I use:

\setbeamercolor{frametitle}{bg=mDarkTeal}

Which results in the same color for frametitles and for section pages. All good.

HOWEVER, in another beamer document, I actually changed the name mDarkTeal to maincolor (because I am aiming to have an own customize mtheme version where I can easily change the colors), so that I had:

\setbeamercolor{frametitle}{bg=maincolor}

With this setup, somehow the frametitles and the section pages did not have the same color anymore: Screenshot 2024-02-06 032738

So I guess a simple fix is just to leave the name of the "main" color as mDarkTeal, although I don't quite understand this. But thank you so much for helping me figure this out.