# Change color in beamer template

\documentclass[xcolor=dvipsnames,10pt]{beamer}
\usepackage{amsmath}
\usepackage{mathrsfs}
\usepackage{braket}
\usepackage{xcolor}
\usepackage{dsfont}
\definecolor{ocre}{RGB}{243,102,25}
\definecolor{blub}{RGB}{51,51,178}
\definecolor{blub2}{RGB}{173,173,224}
\setbeamerfont{itemize/enumerate subbody}{size=\scriptsize}

\begin{document}

\begin{frame}
\frametitle{Approximation of coupler potential}
%\setbeamercolor{block title}{fg=white,bg=blub}
%\setbeamercolor{block body}{use=structure,bg=white}
\begin{block}{ asd}
asdasdasd
\end{block}
\end{frame}

\end{document}


I want to change the block title background color to blub and the block title text color to white.

If i use the command

%\setbeamercolor{block title}{fg=white,bg=blub}


The titel is good, however the block content color is also changed i do not understand why and how can i fix this. I want to keep the old colors, which i think is blub2

The Boadilla theme internally loads the rose color theme, in which the colors of the block title and block body are defined as follows:

\setbeamercolor{block title}{use=structure,fg=structure.fg,bg=structure.fg!20!bg}
\setbeamercolor{block body}{parent=normal text,use=block title,bg=block title.bg!50!bg}


Since the block body background color is defined as block title.bg!50!bg it depends on the background color of the block title which is why block body changes upon redefining the block title color. To overcome this and only change the colors of block title while keeping block body as before, you can use the following:

\setbeamercolor{block title}{fg=white,bg=blub}
\setbeamercolor{block body}{parent=normal text,use=block title,bg=structure.fg!20!bg!50!bg}


\documentclass[xcolor=dvipsnames,10pt]{beamer}

\definecolor{blub}{RGB}{51,51,178}

\setbeamercolor{block title}{fg=white,bg=blub}
\setbeamercolor{block body}{parent=normal text,use=block title,bg=structure.fg!20!bg!50!bg}

\begin{document}

\begin{frame}
\frametitle{Approximation of coupler potential}
\begin{block}{ asd}
asdasdasd
\end{block}
\end{frame}
\end{document}

• the tex wizard has spoken Nov 23, 2020 at 12:18