I have used this answer from the question about how to design a beamer theme from scratch to design a Beamer theme to look like a university presentation (Powerpoint) template. There are 3 colour options for the Powerpoint template (blue,green,slate). I know one option for a solution would be to create 3 separate colour themes and to just call them with;


What I would like to do though is to define all the different colours in one colortheme file and then be able to use an option to call them as follows

\usetheme[blue]{mytheme}  %or green or slate

I have seen questions on the site that seem to use \DeclareOption (at this question, but couldn't get to work) or \DeclareOptionBeamer (This question & This question - didn't really understand these solutions)

Ideally what I would like is a solution where I can define differently in the beamercolorthememytheme.sty the same colour names depending on what option was chosen. For example if option blue was chosen Beamer would know that \definecolor{col1}{RGB}{104,7,90} but if option green was chosen it would know that \definecolor{col1}{RGB}{81,139,36} etc

Hopefully this is enough info but if not let me know in the comments

This is what I have in my beamercolorthememytheme.sty


% define colours from NUIG stylesheet
% set colours for different elements
\setbeamercolor*{title page header}{fg=col5}
\setbeamercolor{block title}{bg=col1,fg=col5}

1 Answer 1


The following example shows how to change the colour of the frame title conditionally. blue will be used as the default colour, in case no option is specified.

Consider the following MWE:






with the corresponding beamerthememytheme.sty, which does little more than just pass the colour option to the colour theme.





and the colour theme beamercolorthememytheme.sty:


\ExecuteOptionsBeamer{style=blue} % blue will be default if nothing is given


    \definecolor{col1}{RGB}{0,255,0} % green
        \definecolor{col1}{RGB}{255,0,0} % red
      \definecolor{col1}{RGB}{0,0,255} % blue



enter image description here

  • This works great but when I try to define a third option I can't get the 3 options to work. Does the code have to be different for a third option to apply?
    – gman
    Feb 19, 2016 at 19:31
  • @gman see the edit Feb 19, 2016 at 20:01
  • Perfect; I was missing the extra \else% and \fi% when trying to add a third option. All working fine now.
    – gman
    Feb 19, 2016 at 20:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .