1
\documentclass{beamer}
 %\usepackage{etoolbox} (this is necessary for old beamer versions)
%\usepackage{graphicx}
%\usepackage{color}

\usetheme{Madrid}

% Definition %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\definecolor{studentbrown}{RGB}{124,71,50}

\BeforeBeginEnvironment{definition}{%
    \setbeamercolor{block title}{fg=white,bg=studentbrown}
    \setbeamercolor{block body}{fg=black, bg=studentbrown!20!white}
}
\AfterEndEnvironment{definition}{
        \setbeamercolor{block title}{use=structure,fg=white,bg=structure.fg!75!black}
        \setbeamercolor{block body}{parent=normal text,use=block title,bg=block title.bg!10!bg}
}

\begin{document}

\begin{frame}

\begin{definition}
test
\end{definition}

\end{frame}

\end{document}

enter image description here

I want to change the brown color by another color

2

Change the colour in the command \definecolor{studentbrown}{RGB}{3,14,159}

\documentclass{beamer}
 %\usepackage{etoolbox} (this is necessary for old beamer versions)
%\usepackage{graphicx}
%\usepackage{color}

\usetheme{Madrid}

% Definition %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\definecolor{studentbrown}{RGB}{3,14,159}

\BeforeBeginEnvironment{definition}{%
    \setbeamercolor{block title}{fg=white,bg=studentbrown}
    \setbeamercolor{block body}{fg=black, bg=studentbrown!20!white}
}
\AfterEndEnvironment{definition}{
        \setbeamercolor{block title}{use=structure,fg=white,bg=structure.fg!75!black}
        \setbeamercolor{block body}{parent=normal text,use=block title,bg=block title.bg!10!bg}
}

\begin{document}

\begin{frame}

\begin{definition}
test
\end{definition}

\end{frame}

\end{document}

enter image description here

  • Thank you but please what is the general method? – Student Apr 16 at 9:52
  • @Student This is general, you can use whatever color you want and give it whatever name you like – ufo Apr 16 at 9:54
  • I mean how can I know the code of the orange color for example? – Student Apr 16 at 9:55
  • @Student rapidtables.com/web/color/orange-color.html – ufo Apr 16 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.