我希望警报块中的列表项目符号为红色,其他项目符号为蓝色。问题是我无法获得正确的颜色。
以下是之前的内容
\documentclass[t]{beamer}
\usepackage{xcolor}
\definecolor{red}{HTML}{DC322F}
\definecolor{blue}{HTML}{268BD2}
\colorlet{bullet-list-color}{blue}
\colorlet{alert-list-color}{red}
\colorlet{block-headings-color}{blue}
\colorlet{alert-headings-color}{red}
以及测试框架
\begin{frame}
\begin{alertblock}{Alert}
\begin{description}
\item[Alert 1] some explanations.
\item[Alert 2] some explanations.
\end{description}
\end{alertblock}
\begin{block}{Block}
\begin{description}
\item[Block 1] some explanations.
\item[Block 1] some explanations.
\end{description}
\end{block}
\end{frame}
如果我添加
\setbeamercolor{description item}{fg=bullet-list-color}
\setbeamercolor{description item alerted}{fg=alert-list-color}
如果我将其修改为
\setbeamercolor{normal description item}{fg=bullet-list-color}
\setbeamercolor{description item alerted}{fg=alert-list-color}
我尝试用以下方法纠正
\setbeamercolor{normal description item}{fg=bullet-list-color}
\setbeamercolor{description item block}{fg=bullet-list-color}
\setbeamercolor{description item alerted}{fg=alert-list-color}
没有成功。
有人能告诉我如何修改块内列表的颜色吗?
答案1
\documentclass[t]{beamer}
\definecolor{red}{HTML}{FC322F}
\definecolor{blue}{HTML}{268BD2}
\colorlet{bullet-list-color}{blue}
\colorlet{alert-list-color}{red}
\colorlet{block-headings-color}{blue}
\colorlet{alert-headings-color}{red}
\setbeamercolor{description item}{fg=bullet-list-color}
\usepackage{etoolbox}
\AtBeginEnvironment{alertblock}{%
\setbeamercolor{description item}{fg=alert-list-color}
}
\setbeamercolor{block title}{fg=block-headings-color}
\setbeamercolor{block title alerted}{fg=alert-headings-color}
\begin{document}
\begin{frame}
\begin{alertblock}{Alert}
\begin{description}
\item[Alert 1] some explanations.
\item[Alert 2] some explanations.
\end{description}
\end{alertblock}
\begin{block}{Block}
\begin{description}
\item[Block 1] some explanations.
\item[Block 1] some explanations.
\end{description}
\end{block}
\end{frame}
\end{document}