30

I'm in the process of creating a custom Beamer theme. I know how to change the color of fonts for certain elements within an itemize or enumerate block, but I can't seem to figure out how to specific the color in a block as depicted below. For example:

\begin{block}{Change the font color here}
    some text
    some more text
\end{block}

I would like to alter the color of the {Change the font color here} area for my theme. I am trying to use this code in my .sty file to change the color to black:

\setbeamercolor{block}{fg=black}

What am I doing wrong?

34

You can modify the color using the block title template:

\documentclass{beamer}

\setbeamercolor{block title}{bg=red!30,fg=black}

\begin{document}

\begin{frame}
\begin{block}{Change the font color here}
    some text
    some more text
\end{block}
\end{frame}

\end{document}

enter image description here

  • Many thanks! This was exactly what I was looking for. – dr.bunsen Oct 31 '11 at 17:04
37

I think I totally misunderstood this question, but for what it's worth, here's my answer to (what I thought was) the question.

You could define another environment like so:

\newenvironment{variableblock}[3]{%
  \setbeamercolor{block body}{#2}
  \setbeamercolor{block title}{#3}
  \begin{block}{#1}}{\end{block}}

Then you can set the colours of the blocks as optional arguments:

\begin{variableblock}{Title}{bg=blue,fg=white}{bg=green,fg=red}
  Stuff
\end{variableblock}

This makes the background of the body blue and the background of the title block green. It also makes the body text white and the block title text red.

blocks of variable colour

21

You can also wrap the \setbeamercolor statement within a {} group. The change is only local

{
\setbeamercolor{block}{bg=red, fg=white}
\begin{block}{}
...
\end{block}
}

For temporary use, say highlighting something, you can also use

\only<1,3,7>{
\setbeamercolor{block}{bg=red, fg=white}
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.