1

How to change the block color without theme? I want to change examplebox and alert color.

  • title style:
    • fg: white
    • bg: example block title color
  • body style:
    • fg: black
    • bg: example block title color!10

I wrote following code, but I couldn't be realized.

\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}

enter image description here

  • after insert \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} enter image description here

1 Answer 1

0

With \setbeamercolor{block title example}{use=block title example, fg=white,bg=block title example.fg} you define the colour based on itself, this will result in a loop.

Instead, you can change the colours like this:

\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}

enter image description here

I know you said you'd like to change the colours without theme, but what you describe is exactly what the orchid colour theme does. It changes the colours of the blocks, nothing more or less:

\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}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .