如何在没有主题的情况下更改块颜色?

如何在没有主题的情况下更改块颜色?

如何在没有主题的情况下更改块颜色?我想更改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}

在此处输入图片描述

  • 插入后\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} 在此处输入图片描述

答案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}

相关内容