6

In Beamer, I used the theme Ann Arbor. I want to achieve this type of gradient color on my title frame.

enter image description here

It seems that I have trouble changing the frame title background to a gradient color. I would like this part (encircled in red, with an arrow) to be changed to a cyan color going to black. [Please ignore the encircled block]. How do I do this? Thank you.

\documentclass[pdf]{beamer}
\mode<presentation>{\usetheme{AnnArbor}}
\usecolortheme{whale}
\setbeamercolor{section in toc}{fg=red}
%%%

\setbeamercolor{structure}{fg=cyan!80!black}
\setbeamercolor*{block title example}{fg=blue!50,bg= blue!10}
\setbeamercolor*{block body example}{fg= red,bg= blue!5}
\usefonttheme{structuresmallcapsserif}

\setbeamertemplate{footline}[page number]{} 

\setbeamercolor{headline}{fg=blue!90!black,bg=cyan!90!black}
\setbeamercolor{palette primary}{fg=white,bg=cyan!90!black}
\setbeamercolor{palette secondary}{fg=white,bg=cyan!90!black}
\setbeamercolor{palette tertiary}{fg=white,bg=black}
\setbeamercolor{frametitle}{fg=white,bg=cyan!50!black}
%%%%


\title{Some Random Stuff}
\subtitle{First time to code xD}

\begin{document}
\begin{frame}
    \titlepage
\end{frame}



\begin{frame}{Testing}
\frametitle{Test}
Blah blah\\


\begin{block}{A block}
    Some text
\end{block}

\end{frame}

\end{document}

enter image description here

4

The code for the shaded frametitle is borrowed from beamerouterthemeshadow.sty. You can adjust the colour in the lines \colorlet{titleleft}{cyan} \colorlet{titleright}{black}

\documentclass{beamer}

\mode<presentation>{\usetheme{AnnArbor}}
\usecolortheme{whale}

\setbeamercolor{frametitle}{parent=subsection in head/foot}
\setbeamercolor{frametitle right}{parent=section in head/foot}

\makeatletter
\pgfdeclarehorizontalshading[frametitle.bg,frametitle right.bg]{beamer@frametitleshade}{\paperheight}{%
    color(0pt)=(frametitle.bg);
    color(\paperwidth)=(frametitle right.bg)}

\AtBeginDocument{
    \pgfdeclareverticalshading{beamer@topshade}{\paperwidth}{%
        color(0pt)=(bg);
        color(4pt)=(black!50!bg)}
}

\addtobeamertemplate{headline}
{}
{%
    \vskip-0.2pt
    \pgfuseshading{beamer@topshade}
    \vskip-2pt
}


\setbeamertemplate{frametitle}
{%
    \nointerlineskip%
    \vskip-2pt%
    \hbox{\leavevmode
        \advance\beamer@leftmargin by -12bp%
        \advance\beamer@rightmargin by -12bp%
        \beamer@tempdim=\textwidth%
        \advance\beamer@tempdim by \beamer@leftmargin%
        \advance\beamer@tempdim by \beamer@rightmargin%
        \hskip-\Gm@lmargin\hbox{%
            \setbox\beamer@tempbox=\hbox{\begin{minipage}[b]{\paperwidth}%
                    \vbox{}\vskip-.75ex%
                    \leftskip0.3cm%
                    \rightskip0.3cm plus1fil\leavevmode
                    \insertframetitle%
                    \ifx\insertframesubtitle\@empty%
                    \strut\par%
                    \else
                    \par{\usebeamerfont*{framesubtitle}{\usebeamercolor[fg]{framesubtitle}\insertframesubtitle}\strut\par}%
                    \fi%
                    \nointerlineskip
                    \vbox{}%
                \end{minipage}}%
                \beamer@tempdim=\ht\beamer@tempbox%
                \advance\beamer@tempdim by 2pt%
                \begin{pgfpicture}{0pt}{0pt}{\paperwidth}{\beamer@tempdim}
                    \usebeamercolor{frametitle right}
                    \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\paperwidth}{\beamer@tempdim}}
                    \pgfusepath{clip}
                    \pgftext[left,base]{\pgfuseshading{beamer@frametitleshade}}
                \end{pgfpicture}
                \hskip-\paperwidth%
                \box\beamer@tempbox%
            }%
            \hskip-\Gm@rmargin%
        }%
        \nointerlineskip
        \vskip-0.2pt
        \hbox to\textwidth{\hskip-\Gm@lmargin\pgfuseshading{beamer@topshade}\hskip-\Gm@rmargin}
        \vskip-2pt
    }
\makeatother

\setbeamercolor{section in toc}{fg=red}
%%%

\setbeamercolor{structure}{fg=cyan!80!black}
\setbeamercolor*{block title example}{fg=blue!50,bg= blue!10}
\setbeamercolor*{block body example}{fg= red,bg= blue!5}
\usefonttheme{structuresmallcapsserif}

\setbeamertemplate{footline}[page number]{} 

\setbeamercolor{headline}{fg=blue!90!black,bg=cyan!90!black}
\setbeamercolor{palette primary}{fg=white,bg=cyan!90!black}
\setbeamercolor{palette secondary}{fg=white,bg=cyan!90!black}
\setbeamercolor{palette tertiary}{fg=white,bg=black}
\setbeamercolor{frametitle}{fg=white,bg=cyan!50!black}


\colorlet{titleleft}{cyan}
\colorlet{titleright}{black}

\setbeamercolor*{frametitle}{fg=white}

\makeatletter
\pgfdeclarehorizontalshading[titleleft,titleright]{beamer@frametitleshade}{\paperheight}{%
    color(0pt)=(titleleft);
    color(\paperwidth)=(titleright)}
\makeatother

\begin{document}

    \begin{frame}
        \frametitle{Test title}
        Test frame
    \end{frame}

\end{document}

enter image description here

  • Thanks a lot. Although I did not understand the somewhat-complicated syntax since I'm new to LaTex, it worked well during the compilation. Bless you! :) – Enthusiast Dec 30 '15 at 15:31
  • I thought of using this gradient shade on Berkeley theme but no success so far. Intent to use only in frametitle background – Khaaba Jun 25 '17 at 7:20
  • @Khaaba If you have a new question, please ask a new question. This way, much more people can help you – user36296 Jun 25 '17 at 11:10

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.