# Changing the color of environments in beamer

I have just started lerning Latex. So, it is possible that the following doubt is very easy.

I have to do a presentation with Beamer. I know that there exist specific comands to theorems, definitions, examples... I wonder if it is possible to modify those environments and change its default color. That is can I use the Theorem environment in such a way that the color of the block is green instead of blue? In the following example I wanto to change the color of the block to red.

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage{amsfonts}
\usepackage{amsmath, amsthm, amssymb}
\usepackage{enumerate}
\usepackage{graphicx}
\usepackage[english]{babel}
\begin{document}
\begin{frame}{Test}
\begin{theorem}[Pythagoras]
$a^+b^2=c^2$
\end{theorem}
\end{frame}
\end{document}


\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage{amsfonts}
\usepackage{amsmath, amsthm, amssymb}
\usepackage{enumerate}
\usepackage{graphicx}
\usepackage[spanish]{babel}

\AtBeginEnvironment{theorem}{%
\setbeamercolor{block title}{use=example text,fg=white,bg=example text.fg!75!black}
\setbeamercolor{block body}{parent=normal text,use=block title example,bg=block title example.bg!10!bg}
}

\begin{document}
\begin{frame}{Test}
\begin{theorem}[Pythagoras]
$a^+b^2=c^2$
\end{theorem}
\end{frame}
\end{document}


For a yellow colored "Teorema" block, please see the following MWE:

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage{amsfonts}
\usepackage{amsmath, amsthm, amssymb}
\usepackage{enumerate}
\usepackage{graphicx}
\usepackage[spanish]{babel}

\newtheorem{theo}{Teorema}
\AtBeginEnvironment{theo}{%
\setbeamercolor{block title}{use=example text,fg=black,bg=yellow!75!black}
\setbeamercolor{block body}{parent=normal text,use=block title example,bg=yellow!10}
}

\begin{document}
\begin{frame}{Test}
\begin{theo}[Pythagoras]
$a^+b^2=c^2$
\end{theo}
\end{frame}
\end{document}


• Thanks, but I have a doubt. How could I change the color to yellow? I don't see where is the specific command to change the color – mathlife Jun 16 '19 at 16:28
• @mathlife texdoc xcolor or osl.ugr.es/CTAN/macros/latex/contrib/xcolor/xcolor.pdf – Rmano Jun 16 '19 at 16:31
• Finally, my last doubt: How can I change in that environment the word "Theorem" by "Teorema"? – mathlife Jun 16 '19 at 16:50
• @mathlife: I have edited my answer according to your requests. – leandriis Jun 16 '19 at 16:58
• @leandriis A lot of thanks!!!!!!! – mathlife Jun 16 '19 at 17:03