
Para evitar tener demasiados colores, utilizo colores de proyector para enfatizar elementos de mi texto. Se parece a esto:
\documentclass[xcolor=dvipsnames]{beamer}
\usetheme{Madrid}
\newcommand{\gn}[1]{\textcolor{block title example.bg}{{}#1{}}}
\begin{document}
\begin{frame}{Green text}
\gn{This isn't working.}
\begin{example}[boring example]
nothing to see here.
\end{example}
\gn{This is green.}
This is black.
\end{frame}
\end{document}
Ahora, si intento usar el color antes de que el proyector lo use por primera vez (como en "Esto no funciona"), aparece el error:
Package xcolor Error: Undefined color `block title example.bg'.
¿Hay una manera de resolver esto?
Respuesta1
\usebeamercolor[bg]{block title example}
usará el color
\documentclass[xcolor=dvipsnames]{beamer}
\usetheme{Madrid}
\newcommand{\gn}[1]{{\usebeamercolor[bg]{block title example}#1}}
\begin{document}
\begin{frame}{Green text}
\gn{This isn't working.}
\begin{example}[boring example]
nothing to see here.
\end{example}
\gn{This is green.}
This is black.
\end{frame}
\end{document}