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 creating my own beamer theme. I can change the colour of the bullets using \setbeamercolor{}. But how can I change the colour of the text after the bullets? I would like to use it in a .sty file.

\documentclass[10pt]{beamer}

\definecolor{INBObrown}{RGB}{118, 91, 52}
\definecolor{INBOreddishbrown}{RGB}{182, 101, 70}
\definecolor{INBOblue}{RGB}{86, 152, 200}
\setbeamercolor{item}{fg=INBObrown}
\setbeamercolor{subitem}{fg=INBOreddishbrown}
\setbeamercolor{subsubitem}{fg=INBOblue}

\begin{document}

\begin{frame}
  \begin{itemize}
    \item This text should be in colour INBObrown
    \begin{itemize}
      \item This text should be in colour INBOreddishbrown
      \begin{itemize}
        \item This text should be in colour INBOblue
      \end{itemize}
    \end{itemize}
  \end{itemize}
\end{frame}

\end{document}
share|improve this question

migrated from stackoverflow.com Nov 30 '12 at 12:08

This question came from our site for professional and enthusiast programmers.

add comment

1 Answer 1

The following works:

enter image description here

\documentclass[10pt]{beamer}% http://ctan.org/pkg/beamer

\definecolor{INBObrown}{RGB}{118, 91, 52}
\definecolor{INBOreddishbrown}{RGB}{182, 101, 70}
\definecolor{INBOblue}{RGB}{86, 152, 200}
\setbeamercolor{item}{fg=INBObrown}
\setbeamercolor{subitem}{fg=INBOreddishbrown}
\setbeamercolor{subsubitem}{fg=INBOblue}

\makeatletter
\def\beamer@origitem{%
  \@inmatherr\item\@ifnextchar[\@item{\@noitemargtrue\@item[\@itemlabel]%
  \csname beamer@thcfg@\beameritemnestingprefix item\endcsname% Insert colour in \beamer@thc@fg
  \ifx\beamer@thc@fg\@empty\relax\else\color{\beamer@thc@fg}\fi% Execute colour
  }}
\makeatother

\begin{document}

\begin{frame}
  \begin{itemize}
    \item This text should be in colour INBObrown
    \begin{itemize}
      \item This text should be in colour INBOreddishbrown
      \begin{itemize}
        \item This text should be in colour INBOblue
      \end{itemize}
    \end{itemize}
  \end{itemize}
\end{frame}

\end{document}

The idea is to capture the current item (foreground) colour in a macro called \beamer@thc@fg by executing the associated key-value macro. Then, simply applying that colour after setting the item label.

share|improve this answer
    
Your solution works great if I put the \makeatletter stuff in the tex file itself. However, I would like to put that in a theme (.sty file). And then it does not work. –  Thierry Dec 4 '12 at 13:56
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.