0

Thanks to this answer, it is possible to make the shadow of a beamer's block fade to the background color instead of white.

As pointed out by the following MWE, the problem is, the solution provided doesn't work after \begin{document}, which is annoying if one wants to change the background color in the middle of the document.

Hence the question: how to change after preamble the color a beamer's block shadow fades to?

\documentclass{beamer}
\usetheme{Madrid}

\newcommand{\test}[1][yellow]{%
  \setbeamercolor{background canvas}{bg=#1}
  \makeatletter
  \pgfdeclareverticalshading[black,bg]{bmb@shadow}{200cm}{%
    color(0bp)=(#1); color(4bp)=(black!50!bg); color(8bp)=(black!50!bg)}
  \pgfdeclareradialshading[black,bg]{bmb@shadowball}{\pgfpointorigin}{%
    color(0bp)=(black!50!bg); color(4bp)=(#1)}
  \pgfdeclareradialshading[black,bg]{bmb@shadowballlarge}{\pgfpointorigin}{%
    color(0bp)=(black!50!bg); color(4bp)=(black!50!bg); color(8bp)=(#1)}
  %
  \makeatother
}

\test

\begin{document}
\begin{frame}
  \begin{block}{Foo}
    Bar
  \end{block}
\end{frame}
%
\test[cyan]
%
\begin{frame}
  \begin{block}{Foo}
    Bar
  \end{block}
\end{frame}
\end{document}

enter image description here

0

1 Answer 1

1

Using the code from https://github.com/josephwright/beamer/pull/469 the shadow colour is automatically adapted:

\documentclass{beamer}
\usetheme{Madrid}

\setbeamercolor{background canvas}{bg=yellow}

\begin{document}

\begin{frame}
  \begin{block}{Foo}
    Bar
  \end{block}
\end{frame}

\setbeamercolor{background canvas}{bg=cyan}

\begin{frame}
  \begin{block}{Foo}
    Bar
  \end{block}
\end{frame}
\end{document}

enter image description here

1

You must log in to answer this question.

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