3

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

gsbabil
  • 133
  • 2
    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 09: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: https://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
  • 1
    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
  • 1
    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
  • Hi @samcarter, thanks again. I've just added more edits based on your comments on the PDF viewer. I think MuPDF and Sumatra are using the same engine, but the rest are not. Please have a look at the edited section above. I'll try the increasing the thickness of the line and get back accordingly. Thank you. – gsbabil Aug 28 '18 at 23:16
  • Do you know how to ? Otherwise https://tex.stackexchange.com/questions/369758/how-can-i-edit-the-progress-bar-in-beamer-from-a-template-theme/369852#369852 can maybe help. – samcarter_is_at_topanswers.xyz Aug 28 '18 at 23:18
  • Not related to the problem itself, but can you test if the following code reproduces the problem \begin{document} \begin{frame} \maketitle \end{frame} \section{First Section} \addtocounter{section}{3} \end{document} Having the bars on two following pages might make comparing easier. – samcarter_is_at_topanswers.xyz Aug 28 '18 at 23:23
  • Hi @samcarter, thanks a gain. I increased the thickness to 12pt and I think you are right about the thickness (this is weird!). Here's the end result: https://i.imgur.com/zWr7XCv.png

    You may go ahead and post this as an answer. I'm happy to select this as the correct answer for future reference. I'm also adding some further edits above with this screenshot. Thanks a lot!

    – gsbabil Aug 28 '18 at 23:38
  • Out of curiosity, could you please try if https://tex.stackexchange.com/a/448245/36296 still shows the problem? – samcarter_is_at_topanswers.xyz Aug 28 '18 at 23:42
  • Hi @samcarter, I tried https://tex.stackexchange.com/a/448245/36296, and the end-result is here: https://i.imgur.com/UqkJrza.png The problem only seems to appear when white is rendered underneath red by these selected renderers. Thank you. – gsbabil Aug 28 '18 at 23:49
  • Thanks for testing this! if you'd like more information about the problem have a look at https://graphicdesign.stackexchange.com/questions/73601/is-there-a-reason-hillary-clintons-logo-has-hidden-notches – samcarter_is_at_topanswers.xyz Aug 28 '18 at 23:57

2 Answers2

1

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}

enter image description here

bmv
  • 3,588
  • 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 07:47
1

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