# Undesired background-foreground colour blending in Beamer Metropolis theme progress-bar

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.

## 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:

4. Microsoft Edge's built-in 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.

### 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@titleseparator@linewidth}{12pt}
\setlength{\metropolis@progressonsectionpage@linewidth}{12pt}
\makeatother


• I think this is a problem of the pdf viewer. Some viewer think they are smart and try to improve the rendering of very thin lines. If you look into the source code, both lines are drawn as rectangles with the same width and without any colour shading. – samcarter_is_at_topanswers.xyz Aug 28 '18 at 9:05
• Hi @samcarter, thanks. That was an interesting hint! I tested the PDF output from above with MuPDF, and native PDF renderers from Firefox and Google Chrome. But they all seem to demonstrate the same blending. Please see a screenshot from Google Chrome's built-in PDF viewer here: i.imgur.com/1hKQFgq.png P.S. By looking into source-code, did you mean the PDF source or the Metropolis theme? Thanks. – gsbabil Aug 28 '18 at 22:58
• I think all these viewers you list are based on the same pdf engine (not 100% sure for MuPDF), so I would not expect any major differences. You could look for a viewer which lets you disable features such as thin line enhancing, line art smoothing and similar. This will result in a terrible font, but you could test if this is really the cause. – samcarter_is_at_topanswers.xyz Aug 28 '18 at 23:09
• With source code I meant the code from metropolis. I also compared the title and section slide with inkscape and the colour of the elements is identical. What you see in your screenshot is that in your section page the white line from below the red line is a bit visible. I'm pretty sure this is an issue of the viewer. Both rectangles are drawn at the same position. – samcarter_is_at_topanswers.xyz Aug 28 '18 at 23:12
• If you want to circumvent the problem, you could make the lines wider so that such viewer artefacts are less visible. – samcarter_is_at_topanswers.xyz Aug 28 '18 at 23:14

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}{%
}%
\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

You should simply add bg=red to the beamer color progress bar. See the full code:

\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,bg=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}


• Thanks for the quick response. Please note that both the white and red are required for the progress-bar feature. The problem is in the shades of red i.e. see how dark and deep the red line is in the first screenshot, as compared to the red portion in the second. I'd like to have the same dark red, without blending with white and becoming lighter, in the second screenshot. Thank you. – gsbabil Aug 28 '18 at 7:47