我正在尝试使用 beamer 系统颜色来处理 tikz 图片,并尝试遵循此帖子中的方法:
所以我想出了这个:
\documentclass[xcolor=dvipsnames]{beamer}
\usetheme{Madrid}
\usebeamercolor{block body alerted}\definecolor{lred}{named}{bg}
\usebeamercolor{alerted text}\definecolor{dred}{named}{fg}
\usebeamercolor{structure}\definecolor{dblue}{named}{fg}
\usebeamercolor{block body}\definecolor{lblue}{named}{bg}
\usebeamercolor{block title example}\definecolor{dgreen}{named}{bg}
\usebeamercolor{block body example}\definecolor{lgreen}{named}{bg}
\begin{document}
\begin{frame}{colourful text}
\LARGE
\textcolor{lred}{light red}
\textcolor{dred}{dark red}
\textcolor{lblue}{light blue}
\textcolor{dblue}{dark blue}
\textcolor{lgreen}{light green}
\textcolor{dgreen}{dark green}
\end{frame}
\end{document}
奇怪的是,它对某些颜色有效,但对“浅绿色”和“浅蓝色”无效。
我究竟做错了什么?
编辑:直接使用颜色名称,如
\draw[fill=block body alerted.bg] (0,-.25) ellipse (6cm and 3cm);
仅在文档中出现警告块后才有效,并且如果经常使用颜色,则需要大量的打字工作。
答案1
颜色block body example
的定义有点奇怪。它指的是一种bg
颜色,因此指的是前一种颜色。看起来它或多或少地期望先调用正常颜色。您可以使用命令的 *-version 来强制执行此操作:
\documentclass[xcolor=dvipsnames]{beamer}
\usetheme{Madrid}
\usebeamercolor{block body alerted}\definecolor{lred}{named}{bg}
\usebeamercolor{alerted text}\definecolor{dred}{named}{fg}
\usebeamercolor{structure}\definecolor{dblue}{named}{fg}
\usebeamercolor{block body}\definecolor{lblue}{named}{bg}
\usebeamercolor{block title example}\definecolor{dgreen}{named}{bg}
\usebeamercolor*{block body example}\definecolor{lgreen}{named}{bg}
\begin{document}
\begin{frame}{colourful text}
\LARGE
\textcolor{lred}{light red}
\textcolor{dred}{dark red}
\textcolor{lblue}{light blue}
\textcolor{dblue}{dark blue}
\textcolor{lgreen}{light green}
\textcolor{dgreen}{dark green}
\end{frame}
\end{document}