![Beamer 演示文稿中框的不同颜色](https://linux22.com/image/354552/Beamer%20%E6%BC%94%E7%A4%BA%E6%96%87%E7%A8%BF%E4%B8%AD%E6%A1%86%E7%9A%84%E4%B8%8D%E5%90%8C%E9%A2%9C%E8%89%B2.png)
我正在准备一个 Beamer 演示文稿,其内容类似于以下 MWE:
\documentclass{beamer}
\usepackage[spanish,activeacute]{babel}
\usetheme{Madrid}
\usecolortheme{beaver}
\begin{document}
\title{My title}
\author{My name}
\date{\today}
\begin{frame}
\titlepage
\end{frame}
\begin{frame}
\frametitle{1. First section}
\begin{block}{ONE}
Text for first block
\end{block}
\begin{block}{TWO}
Text for second block
\end{block}
\end{frame}
\end{document}
我需要做什么才能使名为“ONE”和“TWO”的两个框具有不同的颜色?我希望能够为每张幻灯片中的每个框选择所需的颜色,而不是为所有框预先确定颜色。
答案1
一个简单的解决方案是调整两种颜色
\setbeamercolor{block body}{fg=black, bg=green!20!white}
\setbeamercolor{block title}{fg=black, bg=green!60!black}
将每个块设置为您想要的颜色。
\documentclass{beamer}
\usepackage[spanish,activeacute]{babel}
\usetheme{Madrid}
\usecolortheme{beaver}
\begin{document}
\title{My title}
\author{My name}
\date{\today}
\begin{frame}
\titlepage
\end{frame}
\begin{frame}
\frametitle{1. First section}
{
\setbeamercolor{block body}{fg=black, bg=green!20!white}
\setbeamercolor{block title}{fg=black, bg=green!60!black}
\begin{block}{ONE}
Text for first block
\end{block}
}
\begin{block}{TWO}
Text for second block
\end{block}
\end{frame}
\end{document}