[Tex/LaTex] Undesired background-foreground colour blending in Beamer Metropolis theme progress-bar

beamerbeamer-metropoliscolor

I'm having to modify the Beamer Metropolis theme for a rather
dark set of slides. Following is a minimal working example (MWE).

The problem I'm trying to overcome is that there seems to be an
undesired colour blending of the foreground and background colors in
the progress-bar.

Please see the attached screenshots below, where in the first
screenshot the thin red title-separator appears in correct red
colour (without colour blending), but in the following screenshot
the progress-bar colour has red (foreground) and white (background)
blended.

Could someone please point me in the right direction to get rid of
the blending?

Thanks a lot.

Desired Red (with no blending)

Desired Red (with no blending)

Undesired Red (with colour blending)

Undesired Red (with colour blending)

Minimal Working Example

\documentclass{beamer}
\usetheme{metropolis}

\metroset{numbering=fraction}
\metroset{progressbar=frametitle}
\metroset{background=dark}

\setbeamercolor{palette primary}{bg=black,fg=white}
\setbeamercolor{background canvas}{parent=palette primary}
\setbeamercolor{normal text}{fg=white}
\setbeamercolor{progress bar}{use=palette primary,fg=red}

\title{A minimal example}
\date{\today}
\author{Matthias Vogelgesang}
\institute{Centre for Modern Beamer Themes}

\begin{document}
  \maketitle
  \section{First Section}
  \begin{frame}[plain]{First Frame}
    Hello, world!
  \end{frame}
  \section{Second Section}
  \begin{frame}[plain]{First Frame}
    Hello from frame!
  \end{frame}
\end{document}

EDIT (29-Aug-2018)

Based on @samcarter's hint in the comment section below, I tested the PDF output from the MWE with the following PDF renderers:

  1. MuPDF reader
  2. Firefox's built-in PDF reader
  3. Google Chrome's built-in PDF reader
  4. Microsoft Edge's built-in PDF reader
  5. Sumatra PDF reader
  6. Nitro PDF reader
  7. Evince

They all tend to demonstrate the same colour blending effect. I'm attaching another sample picture below to highlight colour blending effect and difference in the tone of the red colour below. Thank you.

Colour blending and different tone of red

More Edit (29-Aug-2018)

Based on further hints from @samcarter around the tickness of the progress-bar line and rendering of thin lines by PDF viewers, I have added the following code to the MWE to increase thickness and the end result does indeed results in coherent tone of red. I'm also attaching a screenshot from MuPDF below.

Although the result is somewhat unexpected, but I'm pleased that the mystery is solved :-). Thanks a lot!

\makeatletter
\metroset{sectionpage=none}
\setlength{\metropolis@progressinheadfoot@linewidth}{12pt}
\setlength{\metropolis@titleseparator@linewidth}{12pt}
\setlength{\metropolis@progressonsectionpage@linewidth}{12pt}
\makeatother

enter image description here

Best Answer

This a rendering problem of the pdf viewer and is actually the same reason why there are hidden notches in Hillary Clinton's logo

The lines are only 0.4pt wide and on the section page the red line is placed above the white line. Many pdf viewer try to be smart and enhance thin lines, smooth line art and what not.

Several possibilities:

  • If the line widths are increased (maybe to above > 1pt) the problem shouldn't be as visible any more.

    \setlength{\metropolis@progressinheadfoot@linewidth}{2pt}
    \setlength{\metropolis@titleseparator@linewidth}{2pt}
    \setlength{\metropolis@progressonsectionpage@linewidth}{2pt}
    
  • Or don't draw the white line underneath the red bar


\documentclass{beamer}
\usetheme{metropolis}

\metroset{numbering=fraction}
\metroset{progressbar=frametitle}
\metroset{background=dark}

\setbeamercolor{palette primary}{bg=black,fg=white}
\setbeamercolor{background canvas}{parent=palette primary}
\setbeamercolor{normal text}{fg=white}
\setbeamercolor{progress bar}{use=palette primary,fg=red}

\title{A minimal example}
\date{\today}
\author{Matthias Vogelgesang}
\institute{Centre for Modern Beamer Themes}

\makeatletter
\setbeamertemplate{progress bar in section page}{
  \setlength{\metropolis@progressonsectionpage}{%
    \textwidth * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}%
  }%
  \begin{tikzpicture}
    \fill[bg] (\metropolis@progressonsectionpage,0) rectangle (\textwidth, \metropolis@progressonsectionpage@linewidth);
    \fill[fg] (0,0) rectangle (\metropolis@progressonsectionpage, \metropolis@progressonsectionpage@linewidth);
  \end{tikzpicture}%
}
\makeatother

\begin{document}
\begin{frame}
\maketitle
\end{frame}
\section{First Section}
\end{document}

  • disable all these enhancements in your pdf viewer - however this probably results in a bad rendering of the font