![如何在没有主题的情况下更改块颜色?](https://linux22.com/image/466609/%E5%A6%82%E4%BD%95%E5%9C%A8%E6%B2%A1%E6%9C%89%E4%B8%BB%E9%A2%98%E7%9A%84%E6%83%85%E5%86%B5%E4%B8%8B%E6%9B%B4%E6%94%B9%E5%9D%97%E9%A2%9C%E8%89%B2%EF%BC%9F.png)
如何在没有主题的情况下更改块颜色?我想更改examplebox
颜色alert
。
- 标题样式:
- fg: 白色
- bg:示例块标题颜色
- 身材:
- fg: 黑色
- bg:示例块标题颜色!10
我写了下面的代码,但无法实现。
\documentclass{beamer}
\usecolortheme[RGB={0,0,255}]{structure}
\setbeamercolor{block title}{use=structure,fg=white,bg=structure.fg!75!black}
\setbeamercolor{block body}{parent=normal text,use=block title,bg=block title.bg!10!}
\setbeamercolor{block title example}{use=block title example, fg=white,bg=block title example.fg}
\setbeamercolor{block body}{parent=normal text,use=block title example,bg=block title example.fg!10}
\begin{document}
\begin{frame}
\begin{block}{block}
This is block.
\end{block}
\begin{exampleblock}{exampleblock}
This is exampleblock.
\end{exampleblock}
\begin{alertblock}{alertblock}
This is alertblock.
\end{alertblock}
\end{frame}
\end{document}
答案1
当\setbeamercolor{block title example}{use=block title example, fg=white,bg=block title example.fg}
你根据颜色本身来定义颜色时,这将导致循环。
相反,你可以像这样改变颜色:
\documentclass{beamer}
\usecolortheme[RGB={0,0,255}]{structure}
\setbeamercolor{block title}{use=structure,fg=white,bg=structure.fg!75!black}
\setbeamercolor{block body}{parent=normal text,use=block title,bg=block title.bg!10!}
\setbeamercolor{block title alerted}{use=alerted text,fg=white,bg=alerted text.fg!75!black}
\setbeamercolor{block title example}{use=example text,fg=white,bg=example text.fg!75!black}
\setbeamercolor{block body alerted}{parent=normal text,use=block title alerted,bg=block title alerted.bg!10!bg}
\setbeamercolor{block body example}{parent=normal text,use=block title example,bg=block title example.bg!10!bg}
\begin{document}
\begin{frame}
\begin{block}{block}
This is block.
\end{block}
\begin{exampleblock}{exampleblock}
This is exampleblock.
\end{exampleblock}
\begin{alertblock}{alertblock}
This is alertblock.
\end{alertblock}
\end{frame}
\end{document}
我知道您说过您想在没有主题的情况下更改颜色,但您描述的正是orchid
颜色主题的作用。它只会更改块的颜色,不多也不少:
\documentclass{beamer}
\usecolortheme[RGB={0,0,255}]{structure}
\usecolortheme{orchid}
\begin{document}
\begin{frame}
\begin{block}{block}
This is block.
\end{block}
\begin{exampleblock}{exampleblock}
This is exampleblock.
\end{exampleblock}
\begin{alertblock}{alertblock}
This is alertblock.
\end{alertblock}
\end{frame}
\end{document}