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.

For once, my question is short and simple: How do I use a beamer defined color in a tikz picture.

For instance, as beamer's documentation states, using beamer's colors is done as follows:

This text is {\usebeamercolor[fg]{alerted text} alerted}.
The following box uses the fore- and background of frametitles:
{
   \usebeamercolor[fg]{frametitle}
   \colorbox{bg}{Frame Title}
}

I would like to use the background color of the titleframe to fill an arrow shape as follows:

\usebeamercolor{frametitle}
\tikz
  \node[fill=\color{bg},single arrow] at (0,0) { };

Anyone has a clue? I'm being scold by xcolors:

! Argument of \XC@col@rlet has an extra }.

share|improve this question

1 Answer 1

up vote 9 down vote accepted

TikZ can use the color names provided by \usebeamercolor directly, you don't need to pass them to \color{...} first. Simply use color=fg for the foreground color, color=bg for the background, and so on:

\documentclass{beamer}
\usepackage{tikz}
\begin{document}
\begin{frame}
Hello

\begin{tikzpicture}
\frametitle{A Frame}
\usebeamercolor{frametitle}
\tikz
  \fill [fill=fg] (0,0) circle [radius=2cm];
\end{tikzpicture}
\end{frame}
\end{document}
share|improve this answer
    
Nice! I didn't suspect how simple this was! TY –  EEva Jun 20 '12 at 9:24
2  
This solution works perfect within beamer because you can change beamer theme and keep color scheme but if you plan to later write a beamerarticle with same code it will fail. beamerarticle doesn't know about beamer colors. –  Ignasi Jun 20 '12 at 9:31
2  
@Ignasi: Good point! For that application you could define a custom command \newcommand{\usebeamercolor}[1]{\definecolor{fg}{rgb}{<whatever>}} that sets the required colors. –  Jake Jun 20 '12 at 9:36

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.