[Tex/LaTex] Changing the colour of Beamer \titlepage using a .sty file

beamercolortitles

I've been looking for an answer everywhere to this, but so far, nothing seems to have worked. What I would like to do is change the background colour and font colour of the \titlepage command, but to do so within the custom .sty file I have generated, i.e. I don't want to have to specify the change in colours within the .tex file.

The (hopefully as basic as possible) .tex file outline is (some lines are commented out to ensure the example can be run without extra files – if you wish to add your own files to see it working, feel free!):

    \documentclass{beamer}
    \usetheme{Oxford}

    \usepackage{color,graphicx}
    \usepackage{epsfig} % Modifies table/figure captions
    \DeclareGraphicsExtensions{.pdf,.png,.jpg}

    \author{Author Name}
    \title{Presentation Title}
    \institute{Institute Name}

    \date{}

    \begin{document}
       \begin{frame}[plain]
          \titlepage
       \end{frame}

       \begin{frame}
          \frametitle{Outline}
          \tableofcontents
       \end{frame}

       \section{Example Section}
       \begin{frame}
          \frametitle{Example Frame}
       \end{frame}

       \section{Second Example}
       \begin{frame}
          \frametitle{Example Frame With a Block}
          \begin{block}{Test Block}
             Testing the block colour here\ldots{}
          \end{block}
       \end{frame}
    \end{document}

The associated beamerthemeOxford.sty file is thus:

    \DeclareOptionBeamer{compress}{\beamer@compresstrue}
    \ProcessOptionsBeamer
    \mode<presentation>

    \useoutertheme[footline=authortitle]{miniframes}
    \useinnertheme{circles}
    \usecolortheme{whale}
    \usecolortheme{orchid}

    % Define the colours that are to be used in the presentation
    \definecolor{oxfordblue}{RGB}{0,33,71}          % Oxford Blue
    \definecolor{oxfordgold}{cmyk}{0,0.21,0.60,0.30}    % Oxford Gold

    % Set which colours apply to which structures
    \setbeamercolor{structure}{fg=oxfordblue}
    \setbeamercolor{titlelike}{parent=structure}
    \setbeamercolor{frametitle}{fg=oxfordblue}
    \setbeamercolor{title}{fg=oxfordblue}
    \setbeamercolor{item}{fg=oxfordblue}
    \setbeamercolor{section in head/foot}{bg=oxfordblue,fg=white}

    % Define the headline and titlebar
    \setbeamertemplate{headline}
    {
       \begin{beamercolorbox}[wd=1\paperwidth,left]{section in head/foot}
       \vskip2pt
       \insertnavigation{0.85\paperwidth}
       \vskip2pt
       \end{beamercolorbox}
    }

    \usepackage{tikz}
    \usetikzlibrary{backgrounds}
    \usepackage[absolute,overlay]{textpos} 
    % \pgfdeclareimage[height=1.1cm]{logo}{logo_file}
    \setlength{\TPHorizModule}{\paperwidth}
    \setlength{\TPVertModule}{\paperheight}
    \setbeamertemplate{frametitle}
    {
       \vskip-1pt
       \begin{beamercolorbox}[wd=1\paperwidth,left]{section in head/foot}
          \vskip-15pt
          \begin{tikzpicture}
             \shade[left color=white,right  color=oxfordblue] (0,0) rectangle +(11,0.02);
          \end{tikzpicture}
          \vskip-2pt
          \hskip10pt\strut\insertframetitle\strut\\
       \end{beamercolorbox} 
       \begin{textblock}{0.2}[0.5,0.5](0.99,0.07)
          % \pgfuseimage{logo}
       \end{textblock} 
    }

    % Adapt other segments of code
    \setbeamertemplate{blocks}[rounded][shadow=true]
    \setbeamertemplate{navigation symbols}{}

    % Ensures navigation circles are displayed
    \usepackage{remreset}
    \makeatletter
    \@removefromreset{subsection}{section}
    \makeatother
    \setcounter{subsection}{1}

    % Reformat Title Page to our own specifications
    \setbeamertemplate{title page}
    {
    \setbeamercolor*{background canvas}{fg=oxfordblue,bg=oxfordblue}
    %   \setbeamercolor*{title}{fg=oxfordblue,bg=oxfordblue}
    %   \setbeamercolor{titlelike}{parent=structure}
       \begin{columns}
          \column{0.7\textwidth}
          \usebeamerfont{title}\inserttitle
          \ifx\insertsubtitle\@empty
          \else
             \vskip2ex
             \usebeamerfont{subtitle}\insertsubtitle
          \fi
          \ifx\insertauthor\@empty
          \else
             \vskip2ex
             \usebeamerfont{author}\insertauthor
          \fi
          \ifx\insertdate\@empty
          \else
             \vskip2ex
             \usebeamerfont{date}\insertdate%
          \fi
          \ifx\insertinstitute\@empty
          \else
             \vskip2ex
             \usebeamerfont{institute}\insertinstitute%
          \fi
          \vfill
          \column{0.3\textwidth}
          % \includegraphics[width=0.5\textwidth]{pic1}\\
          \vskip5pt
          % \includegraphics[width=0.5\textwidth]{pic2}\\
          \vskip5pt
          % \includegraphics[width=0.5\textwidth]{pic3}
       \end{columns}
    }

    \mode
    <all>

There were various other hacks that I tried, but they all came to nothing and were inelegant kludges. In either case, the background colour of the title page remains resolutely white, whereas I want to have the background as oxfordblue and the font as white. Does anyone know what I'm doing wrong?

Thanks for your help.

Best Answer

Good question! And to be honest, I do not know the answer, but I use a workaround in my own style files. In the .sty file, I define a wrapper macro for the titlepage similar to

      \newcommand{\insertoxfordtitle}{%
        \setbeamercolor*{background canvas}{fg=oxfordblue,bg=oxfordblue}
        \begin{frame}[plain]
        \titlepage
      \end{frame}
      \setbeamercolor{background canvas}{fg=oxfordblue,bg=white}
    }

In the .tex file I replace the title frame by \insertoxfordtitle.

Relevant changes to the .sty file:

    % Reformat Title Page to our own specifications
    \setbeamercolor{title}{fg=white}
    \setbeamercolor*{subtitle}{fg=white}
    \setbeamercolor*{date}{fg=white}

      \newcommand{\insertoxfordtitle}{%
        \setbeamercolor*{background canvas}{fg=oxfordblue,bg=oxfordblue}
        \begin{frame}[plain]
        \titlepage
      \end{frame}
      \setbeamercolor{background canvas}{fg=oxfordblue,bg=white}
    }

   \setbeamertemplate{title page}{
       \begin{columns}
          \column{0.7\textwidth}
          \usebeamerfont{title}\usebeamercolor[fg]{title}\inserttitle
          \ifx\insertsubtitle\@empty
          \else
             \vskip2ex
             \usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle
          \fi
          \ifx\insertauthor\@empty
          \else
             \vskip2ex
             \usebeamerfont{author}\usebeamercolor[fg]{author}\insertauthor
          \fi
          \ifx\insertdate\@empty
          \else
             \vskip2ex
             \usebeamerfont{date}\usebeamercolor[fg]{date}\insertdate%
          \fi
          \ifx\insertinstitute\@empty
          \else
             \vskip2ex
             \usebeamerfont{institute}\usebeamercolor[fg]{institut}\insertinstitute%
          \fi
          \vfill
          \column{0.3\textwidth}
          % \includegraphics[width=0.5\textwidth]{pic1}\\
          \vskip5pt
          % \includegraphics[width=0.5\textwidth]{pic2}\\
          \vskip5pt
          % \includegraphics[width=0.5\textwidth]{pic3}
       \end{columns}
    }

enter image description here