# Beamer: Using a defined color for setting another one

I want to use the color template "block title bg" to make a box around the title of my presentation. My code is \setbeamercolor{title}{bg=block title.bg} but I get the error Package xcolor Error: Undefined color 'block title.bg'. I've been trying what says here and here, but without results. I tried at some point \setbeamercolor{title}{bg=\usebeamercolor[bg]{block title}} and the document compiled succesfully but without the colored box around the title. Any suggestions? Thanks in advance!

EDIT: I'd also like to know where to find the appropriate list of colors and templates. The Beamer Appearance Cheat sheet provides the names but not the .fg for using in these cases. Also, MWE:

\documentclass{beamer}
\mode<presentation>
{
\usetheme{Pittsburgh}
\usecolortheme{rose}
\useinnertheme{rounded}
\setbeamercovered{invisible} %hace que no se vea lo que está después del pause
\setbeamercolor{titlelike}{bg=block title.bg}
=white,bg=Blue!650}%
}
\usepackage[utf8]{inputenc}
\begin{document}
\title{fancy title}
\author{John Doe}
\date{some day}
\institute{some university}
\maketitle
\begin{frame}
{fancy title}
some text
\begin{theorem}
foo bar
\end{theorem}
\end{frame}
\end{document}


Sorry for the crammed example, but I don't know how to insert line breaks (mea maxima culpa).

To copy both fg and bg parts of another beamer color you can use the parent option of \setbeamercolor as in:

\setbeamercolor{titlelike}{parent=block title}


Instead, if you want to copy only one part, or simply use it in a color expression (like mixing it with another color), you can employ the option use. In your case:

\setbeamercolor{titlelike}{use=block title,bg=block title.bg}

• Concise and elegant! Much obliged! Oct 17, 2015 at 20:12

In beamer, the colour structure is used as the base (parent) for almost all other things. So, you may use the same for frame title too. First we define a colour to be called structure

\definecolor{mycolor}{rgb}{0.4,0.4,0.7}
%% default is
%%\definecolor{beamer@blendedblue}{rgb}{0.2,0.2,0.7} % use structure theme to change
%%\setbeamercolor{structure}{fg=beamer@blendedblue}


In default there is no bg (background) defined but we do it now like

\setbeamercolor{structure}{fg=mycolor,bg=mycolor!20}


With ,bg=mycolor!20 added the titles get the background box

\documentclass{beamer}
\usetheme{Pittsburgh}
\usecolortheme{rose}
\useinnertheme{rounded}
\setbeamercovered{invisible} %hace que no se vea lo que está después del pause
\definecolor{mycolor}{rgb}{0.4,0.4,0.7}
\setbeamercolor{structure}{fg=mycolor,bg=mycolor!20}

\usepackage[utf8]{inputenc}
\begin{document}
\title{fancy title}
\author{John Doe}
\date{some day}
\institute{some university}
\maketitle
\begin{frame}
\frametitle{fancy title}
some text
\begin{theorem}
foo bar
\end{theorem}
\end{frame}
\end{document}


Or simply

\documentclass{beamer}
\usetheme{Pittsburgh}
\usecolortheme{rose}
\useinnertheme{rounded}
\setbeamercovered{invisible} %hace que no se vea lo que está después del pause
\makeatletter
\setbeamercolor{structure}{fg=beamer@blendedblue,bg=beamer@blendedblue!20}
\makeatother

\usepackage[utf8]{inputenc}
\begin{document}
\title{fancy title}
\author{John Doe}
\date{some day}
\institute{some university}
\maketitle
\begin{frame}
\frametitle{fancy title}
some text
\begin{theorem}
foo bar
\end{theorem}
\end{frame}
\end{document}