\documentclass[xcolor=dvipsnames,10pt]{beamer}
\usetheme{Boadilla}
\usepackage{amsmath}
\usepackage{mathrsfs}
\usepackage{braket}
\usepackage{xcolor}
\usepackage{dsfont}
\definecolor{ocre}{RGB}{243,102,25}
\definecolor{blub}{RGB}{51,51,178}
\definecolor{blub2}{RGB}{173,173,224}
\setbeamerfont{itemize/enumerate subbody}{size=\scriptsize}
\begin{document}
\begin{frame}
\frametitle{Approximation of coupler potential}
%\setbeamercolor{block title}{fg=white,bg=blub}
%\setbeamercolor{block body}{use=structure,bg=white}
\begin{block}{ asd}
asdasdasd
\end{block}
\end{frame}
\end{document}
我想将块标题背景颜色更改为蓝色,并将块标题文本颜色更改为白色。
如果我使用命令
%\setbeamercolor{block title}{fg=white,bg=blub}
标题很好,但是块内容颜色也变了,我不明白为什么,我该如何解决这个问题。我想保留旧的颜色,我认为是 blub2
答案1
主题Boadilla
内部加载了rose
颜色主题,其中块标题和块主体的颜色定义如下:
\setbeamercolor{block title}{use=structure,fg=structure.fg,bg=structure.fg!20!bg}
\setbeamercolor{block body}{parent=normal text,use=block title,bg=block title.bg!50!bg}
由于block body
背景颜色定义为block title.bg!50!bg
它取决于的背景颜色,block title
因此block body
在重新定义block title
颜色时会发生变化。为了克服这个问题,只改变的颜色,block title
同时保持block body
与以前一样,您可以使用以下命令:
\setbeamercolor{block title}{fg=white,bg=blub}
\setbeamercolor{block body}{parent=normal text,use=block title,bg=structure.fg!20!bg!50!bg}
\documentclass[xcolor=dvipsnames,10pt]{beamer}
\usetheme{Boadilla}
\definecolor{blub}{RGB}{51,51,178}
\setbeamercolor{block title}{fg=white,bg=blub}
\setbeamercolor{block body}{parent=normal text,use=block title,bg=structure.fg!20!bg!50!bg}
\begin{document}
\begin{frame}
\frametitle{Approximation of coupler potential}
\begin{block}{ asd}
asdasdasd
\end{block}
\end{frame}
\end{document}