# Changing the color of sections-subsections in the head II

According to this answer, we have

\documentclass[xcolor=dvipsnames]{beamer}
\usecolortheme[named=blue]{structure}

%------------------------\AtBeginSubsection[]----------------------
\AtBeginSubsection[]{
\transsplitverticalout
\tableofcontents[currentsection,currentsubsection]
\end{frame}
}

%----------------------------------------------------------------
%----------------------------------------------------------------

\title[The essential numerical range and the Olsen problem]{The
essential numerical range and the Olsen problem}
\author[{Student} (University of ....)]{Student}

\usepackage{tikz}
%-----------------------------------------------------------------------
\colorlet{titleleft}{blue!30!black}
\colorlet{titleright}{blue!30!black}

\setbeamercolor*{frametitle}{fg=white}

%-----------------------------------------------------------------------
\makeatletter
{\paperheight}{%
color(0pt)=(titleleft);
color(\paperwidth)=(titleright)}
\makeatother

%-----------------------------footline-----------------------------
\setbeamertemplate{footline}{
\leavevmode%
\hbox{%
\end{beamercolorbox}%
%            \hspace*{3em}
\end{beamercolorbox}%
\end{beamercolorbox}%
}%
\vskip0pt%
}
%--------------------------------------------------
\colorlet{myblue}{blue!30!black}
\colorlet{myyellow}{yellow!30!white}

\colorlet{titleleft}{myblue}  %<----- left half of frame title background color
\colorlet{titleright}{myblue} %<----- right half of frame title background color
\setbeamercolor*{frametitle}{fg=white} %<---- Color of the frame title text
%---------------------------------------------------------------
\begin{document}
\section{Introduction}
\section{Positive linear relations}
\section{Lattice linear relations}
\section{Domination by a positive compact relation.}
\subsection{Linear relation}
\subsection{Riesz spaces}
\begin{frame}{Linear relations}

\end{frame}

\end{document}


I want to change the color of the title frame to for example the grey instead of blue and the color of sections to blue instead of black.

To change the background color of the section titles in the header from black to your blue, add \setbeamercolor*{section in head/foot}{bg=myblue, fg=white} and to change the background color of the frame title from your blue to gray, replace \colorlet{titleleft}{myblue} \colorlet{titleright}{myblue} by \colorlet{titleleft}{gray} \colorlet{titleright}{gray}.

As A Diyanat already explained in their answer, bg changed the background color and fg changed the font color.

As requested in teh comments, here is the complete MWE with some hopefully helpful explanatory annotations:

\documentclass[xcolor=dvipsnames]{beamer}
\usecolortheme[named=blue]{structure}

%------------------------\AtBeginSubsection[]----------------------
\AtBeginSubsection[]{
\transsplitverticalout
\tableofcontents[currentsection,currentsubsection]
\end{frame}
}

%-----------------custom frame title background--------------------
\makeatletter
{\paperheight}{%
color(0pt)=(titleleft);
color(\paperwidth)=(titleright)}
\makeatother

%-----------------------------footline-----------------------------
\setbeamertemplate{footline}{
\leavevmode%
\hbox{%
\end{beamercolorbox}%
%            \hspace*{3em}
\end{beamercolorbox}%
\end{beamercolorbox}%
}%
\vskip0pt%
}

%%%%% Custom color definitions used in the head and foot line of the frames %%%%%
\colorlet{myblue}{blue!30!black} %<----- define the new color myblue
\colorlet{myyellow}{yellow!30!white} %<----- define the new color myyellow

\setbeamercolor{author in head/foot}{bg=myblue} %<----- background color of author in footline
\setbeamercolor{title in head/foot}{bg=myyellow,fg=myblue} %<----- background color and font color for presentation title in footline
\setbeamercolor{page number in head/foot}{bg=myblue,fg=white} %<----- background and font color fot page numbers in the footline

\setbeamercolor*{section in head/foot}{bg=myblue, fg=white} %<----- background and font color for the sections in the header
\setbeamercolor*{subsection in head/foot}{bg=myyellow,fg=myblue} %<----- background and font color for the subsections in the header

\colorlet{titleleft}{gray}  %<----- left half of frame title background color
\colorlet{titleright}{gray} %<----- right half of frame title background color
\setbeamercolor*{frametitle}{fg=white} %<---- Color of the frame title text
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%% Title and Author Information %%%%%
\title[The essential numerical range and the Olsen problem]{The
essential numerical range and the Olsen problem}
\author[{Student} (University of ....)]{Student}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
\section{Introduction}
\section{Positive linear relations}
\section{Lattice linear relations}
\section{Domination by a positive compact relation.}
\subsection{Linear relation}
\subsection{Riesz spaces}
\begin{frame}{Linear relations}

\end{frame}

\end{document}

• Thank you for your great answer. Please juste could you please write me the necessary codes because I think that some codes can be ommited such that \setbeamercolor{author in head/foot}{bg=blue!30!black} \setbeamercolor{title in head/foot}{bg=yellow!30!white,fg=blue!30!black} \setbeamercolor{page number in head/foot}{bg=blue!30!black,fg=white} – Student Jul 21 at 11:19
• @Student: Sorry, but there seems to be a misunderstanding originating from the suggestion in my previous answer. Either use \setbeamercolor{author in head/foot}{bg=blue!30!black} OR \colorlet{myblue}{blue!30!black}\setbeamercolor{author in head/foot}{bg=myblue} not both. – leandriis Jul 21 at 11:37
• The latter is especially useful if you want to use the same blude color for more than one element and maybe later on decide that you would like to use a slightly different shade of blue. In this case, you will only have to change the definition of \colorlet{myblue}{blue!30!black} instead of touching every \setbeamercolor.... – leandriis Jul 21 at 11:37
• If this is not what you refered to, please add some further explanation especially regarding "the necessary codes". – leandriis Jul 21 at 11:37
• Thanks a lot. Just I hope to include in this answer the code for my benifit and the benifit of the reader. Thanks a lot. – Student Jul 21 at 11:48

To change the foreground and background colors of the beamer frame, you could use the following lines:

\colorlet{titleleft}{gray!80}  %<----- left half of frame title background color
\colorlet{titleright}{gray!60} %<----- right half of frame title background color
\setbeamercolor*{frametitle}{fg=white} %<---- Color of the frame title text


Also for changing left frame header, we have:

\setbeamercolor{palette quaternary}{bg=Blue,fg=red}


It is worth noting that 'fg' and 'bg' means the foreground and background colors, respectively. In summary consider the following sample:

 \documentclass[xcolor=dvipsnames]{beamer}

\makeatletter
{\paperheight}{%
color(0pt)=(titleleft);
color(\paperwidth)=(titleright)}
\makeatother

\colorlet{titleleft}{gray!80}
\colorlet{titleright}{gray!60}
\setbeamercolor*{frametitle}{fg=white}
\setbeamercolor{palette quaternary}{bg=Blue,fg=white}

\begin{document}
\section{Introduction}
\section{Positive linear relations}
\begin{frame}{Linear relations}
Example.
\end{frame}
\end{document}