# Using beamer's colours

I'm trying to use the beamer system colours for tikz pictures, and I try to follow the approach from this post:

How to get actual values of colour theme colours in beamer?

So what I came up with is this:

\documentclass[xcolor=dvipsnames]{beamer}
\usebeamercolor{structure}\definecolor{dblue}{named}{fg}
\usebeamercolor{block body}\definecolor{lblue}{named}{bg}
\usebeamercolor{block title example}\definecolor{dgreen}{named}{bg}
\usebeamercolor{block body example}\definecolor{lgreen}{named}{bg}

\begin{document}

\begin{frame}{colourful text}

\LARGE
\textcolor{lred}{light red}
\textcolor{dred}{dark red}

\textcolor{lblue}{light blue}
\textcolor{dblue}{dark blue}

\textcolor{lgreen}{light green}
\textcolor{dgreen}{dark green}

\end{frame}
\end{document}


Strange enough, it works for some colors, but not for "light green" and "light blue".

What am I doing wrong?

Edit: using the colour names directly, as in

 \draw[fill=block body alerted.bg] (0,-.25) ellipse (6cm and 3cm);


only works after there has been an alert block in the document, and it is a lot of typing work if you use the colors often.

The block body example color is defined in a bit curious way. It refers to a bg color and so to a previous color. It looks as if it more or less expects that the normal color has been called first. You can force this by using the *-version of the command:

\documentclass[xcolor=dvipsnames]{beamer}

\usebeamercolor{structure}\definecolor{dblue}{named}{fg}
\usebeamercolor{block body}\definecolor{lblue}{named}{bg}
\usebeamercolor{block title example}\definecolor{dgreen}{named}{bg}
\usebeamercolor*{block body example}\definecolor{lgreen}{named}{bg}
\begin{document}

\begin{frame}{colourful text}

\LARGE
\textcolor{lred}{light red}
\textcolor{dred}{dark red}

\textcolor{lblue}{light blue}
\textcolor{dblue}{dark blue}

\textcolor{lgreen}{light green}
\textcolor{dgreen}{dark green}
\end{frame}
\end{document}

• Thanks! I never would have figured that out... – Jan Aug 18 '19 at 10:23