谢谢这个答案,可以使beamer
的块的阴影淡化为背景颜色而不是白色。
正如以下 MWE 所指出的,问题是,提供的解决方案在之后不起作用\begin{document}
,如果有人想改变文档中间的背景颜色,这会很烦人。
beamer
因此问题是:如何在序言之后改变a 的块阴影淡出的颜色?
\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}
答案1
使用来自的代码https://github.com/josephwright/beamer/pull/469阴影颜色自动调整:
\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}