Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
add comment

3 Answers

up vote 10 down vote accepted

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

share|improve this answer
    
Many thanks! This was exactly what I was looking for. –  dr.bunsen Oct 31 '11 at 17:04
add comment

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

share|improve this answer
add comment

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}
    }
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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