Merge pull request #66 from rchurchley/colours
Simplify colour theme for easy customization
This commit is contained in:
commit
8505d5ba1d
23
README.md
23
README.md
|
@ -40,11 +40,11 @@ presentations, you can run the following command
|
||||||
|
|
||||||
#### Package options
|
#### Package options
|
||||||
|
|
||||||
To use any of options below, call them when invoking *mtheme* in the preabmle of
|
To use any of options below, call them when invoking *mtheme* in the preamble of
|
||||||
the slides, i.e.
|
the slides, i.e.
|
||||||
|
|
||||||
```latex
|
```latex
|
||||||
\usetheme[<options>]{m}
|
\usetheme[<options>]{m}
|
||||||
```
|
```
|
||||||
|
|
||||||
* The `usetitleprogressbar` option adds a thin progress bar similar to the
|
* The `usetitleprogressbar` option adds a thin progress bar similar to the
|
||||||
|
@ -67,6 +67,25 @@ the slides, i.e.
|
||||||
printed.
|
printed.
|
||||||
* Option `noslidenumbers` omits slide numbers entirely.
|
* Option `noslidenumbers` omits slide numbers entirely.
|
||||||
|
|
||||||
|
#### Color customization
|
||||||
|
|
||||||
|
The included `metropolis` color theme is used by default, but its colours can
|
||||||
|
be easily changed to suit your tastes. All of the theme's styles are defined
|
||||||
|
in terms of three beamer colors:
|
||||||
|
|
||||||
|
- `normal text` (dark fg, light bg)
|
||||||
|
- `alerted text` (colored fg, should be visible against dark or light)
|
||||||
|
- `example text` (colored fg, should be visible against dark or light)
|
||||||
|
|
||||||
|
An easy way to customize the theme is to redefine these colors using
|
||||||
|
|
||||||
|
```latex
|
||||||
|
\setbeamercolor{ ... }{ fg= ... , bg= ... }
|
||||||
|
```
|
||||||
|
|
||||||
|
in your preamble. For greater customization, you can redefine any of the other
|
||||||
|
colors in `beamercolorthememetropolis`, including `progress bar`.
|
||||||
|
|
||||||
|
|
||||||
#### Title formatting
|
#### Title formatting
|
||||||
|
|
||||||
|
|
|
@ -3,19 +3,23 @@
|
||||||
% Copyright 2014 Matthias Vogelgesang
|
% Copyright 2014 Matthias Vogelgesang
|
||||||
% Licensed under CC-BY-SA 4.0 International.
|
% Licensed under CC-BY-SA 4.0 International.
|
||||||
%
|
%
|
||||||
% The initial template comes from the HSRM beamer theme by Benjamin Weiss, which
|
|
||||||
% you can find at https://github.com/hsrmbeamertheme/hsrmbeamertheme.
|
|
||||||
%
|
|
||||||
|
|
||||||
\ProvidesPackage{beamercolorthememetropolis}
|
\ProvidesPackage{beamercolorthememetropolis}
|
||||||
|
|
||||||
|
|
||||||
%}}}
|
% Options
|
||||||
%{{{ --- Options ----------------------
|
% =======
|
||||||
|
|
||||||
|
% Option: blockbg
|
||||||
|
% applies a gray background to blocks
|
||||||
|
|
||||||
\newif\if@beamer@metropolis@blockbg
|
\newif\if@beamer@metropolis@blockbg
|
||||||
\@beamer@metropolis@blockbgfalse
|
\@beamer@metropolis@blockbgfalse
|
||||||
\DeclareOptionBeamer{blockbg}{\@beamer@metropolis@blockbgtrue}
|
\DeclareOptionBeamer{blockbg}{
|
||||||
|
\@beamer@metropolis@blockbgtrue
|
||||||
|
}
|
||||||
|
|
||||||
|
% Option: ...
|
||||||
|
|
||||||
\DeclareOptionBeamer*{%
|
\DeclareOptionBeamer*{%
|
||||||
\PackageWarning{beamercolorthememetropolis}{Unknown option `\CurrentOption'}%
|
\PackageWarning{beamercolorthememetropolis}{Unknown option `\CurrentOption'}%
|
||||||
|
@ -23,50 +27,130 @@
|
||||||
|
|
||||||
\ProcessOptionsBeamer
|
\ProcessOptionsBeamer
|
||||||
|
|
||||||
%}}}
|
|
||||||
%{{{ --- Colors ---------------------
|
|
||||||
|
|
||||||
% http://paletton.com/#uid=7050t0kkJkJsntwoyp6gYgoddc4
|
|
||||||
|
% Color definitions
|
||||||
|
% =================
|
||||||
|
%
|
||||||
|
% See http://paletton.com/#uid=7050t0kkJkJsntwoyp6gYgoddc4
|
||||||
|
%
|
||||||
|
|
||||||
\definecolor{mDarkBrown}{HTML}{604c38}
|
\definecolor{mDarkBrown}{HTML}{604c38}
|
||||||
\definecolor{mDarkTeal}{HTML}{23373b}
|
\definecolor{mDarkTeal}{HTML}{23373b}
|
||||||
|
|
||||||
\definecolor{mLightBrown}{HTML}{EB811B}
|
\definecolor{mLightBrown}{HTML}{EB811B}
|
||||||
\definecolor{mMediumBrown}{HTML}{C87A2F}
|
\definecolor{mLightGreen}{HTML}{14B03D}
|
||||||
|
|
||||||
\setbeamercolor{palette primary}{fg=mDarkTeal, bg=black!2}
|
|
||||||
\setbeamercolor{palette secondary}{fg=white, bg=mDarkTeal}
|
|
||||||
\setbeamercolor{palette tertiary}{fg=white, bg=mMediumBrown}
|
|
||||||
\setbeamercolor{palette quaternary}{fg=mDarkBrown}
|
|
||||||
|
|
||||||
\setbeamercolor{title}{parent=palette primary}
|
% Base colors
|
||||||
\setbeamercolor{subtitle}{parent=palette primary}
|
% ===========
|
||||||
\setbeamercolor{author}{parent=palette primary}
|
%
|
||||||
\setbeamercolor{date}{parent=palette primary}
|
% The metropolis color theme is defined in terms of three fundamental styles:
|
||||||
\setbeamercolor{institute}{parent=palette primary}
|
%
|
||||||
|
% - normal text (dark fg, light bg)
|
||||||
|
% - alerted text (colored fg, should be visible against dark or light)
|
||||||
|
% - example text (colored fg, should be visible against dark or light)
|
||||||
|
%
|
||||||
|
% An easy way to customize the theme is to redefine these colors using
|
||||||
|
%
|
||||||
|
% \setbeamercolor{ ... }{ fg= ... , bg= ... }
|
||||||
|
%
|
||||||
|
% in your preamble.
|
||||||
|
%
|
||||||
|
|
||||||
\setbeamercolor{section title}{parent=palette primary}
|
\setbeamercolor{normal text}{%
|
||||||
\setbeamercolor{frametitle}{parent=palette secondary}
|
fg=mDarkTeal,
|
||||||
\setbeamercolor{background canvas}{parent=palette primary}
|
bg=black!2
|
||||||
\setbeamercolor{structure}{fg=mDarkTeal}
|
}
|
||||||
|
|
||||||
\setbeamercolor{normal text}{fg=black!97}
|
\setbeamercolor{alerted text}{%
|
||||||
\setbeamercolor{alerted text}{fg=mLightBrown}
|
fg=mLightBrown
|
||||||
|
}
|
||||||
|
|
||||||
\setbeamercolor{footnote}{fg=mDarkTeal!90}
|
\setbeamercolor{example text}{%
|
||||||
\setbeamercolor{footnote mark}{fg=.}
|
fg=mLightGreen
|
||||||
\setbeamercolor{page number in head/foot}{fg=mDarkTeal}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
% Derived colors
|
||||||
|
% ==============
|
||||||
|
%
|
||||||
|
% These colors are all defined in terms of the above and will update their
|
||||||
|
% appearance if `normal text`, `alerted text`, or `example text` is customized.
|
||||||
|
%
|
||||||
|
% You may also redefine these in your preamble for greater control over the
|
||||||
|
% customization. Beamer colors not defined here are inherited from
|
||||||
|
% `beamercolorthemedefault.sty`
|
||||||
|
%
|
||||||
|
|
||||||
|
% Reset titles and structure to normal text
|
||||||
|
|
||||||
|
\setbeamercolor{titlelike}{use=normal text, parent=normal text}
|
||||||
|
\setbeamercolor{structure}{%
|
||||||
|
% This would be parent=normal text, but the inheritance is overriden by the
|
||||||
|
% explicity color definition for structure in `beamercolorthemedefault.sty`
|
||||||
|
fg=normal text.fg
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
% Frame titles and `\plain` slides
|
||||||
|
|
||||||
|
\setbeamercolor{frametitle}{use=palette primary, parent=palette primary}
|
||||||
|
\setbeamercolor{palette primary}{%
|
||||||
|
% The “primary” palette should be used for the most important navigational
|
||||||
|
% elements, and possibly of other elements.
|
||||||
|
% The metropolis color theme uses it for frame titles and `\plain` slides.
|
||||||
|
use=normal text,
|
||||||
|
fg=normal text.bg,
|
||||||
|
bg=normal text.fg
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
% Progress bar and title separator
|
||||||
|
|
||||||
|
\setbeamercolor{title separator}{use=progress bar, parent=progress bar}
|
||||||
|
\setbeamercolor{progress bar}{%
|
||||||
|
use=alerted text,
|
||||||
|
fg=alerted text.fg,
|
||||||
|
bg=normal text.bg!50!fg
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
% Blocks
|
||||||
|
|
||||||
\if@beamer@metropolis@blockbg
|
\if@beamer@metropolis@blockbg
|
||||||
|
\setbeamercolor{block title}{%
|
||||||
\setbeamercolor{block title}{use=palette primary,parent=palette primary,bg=palette primary.bg!80!fg}
|
use=normal text,
|
||||||
\setbeamercolor{block title alerted}{use={palette primary,alerted text},parent=palette primary,fg=alerted text.fg,bg=palette primary.bg!80!fg}
|
fg=normal text.fg,
|
||||||
\setbeamercolor{block title example}{use={palette primary,example text},parent=palette primary,fg=example text.fg,bg=palette primary.bg!80!fg}
|
bg=normal text.bg!80!fg
|
||||||
|
}
|
||||||
\setbeamercolor{block body}{use=block title,parent=normal text,bg=block title.bg!50}
|
\else
|
||||||
\setbeamercolor{block body alerted}{use={normal text,block body},parent=normal text,bg=block body.bg}
|
\setbeamercolor{block title}{use=normal text, parent=normal text}
|
||||||
\setbeamercolor{block body example}{use={normal text,block body},parent=normal text,bg=block body.bg}
|
|
||||||
|
|
||||||
\fi
|
\fi
|
||||||
|
|
||||||
|
\setbeamercolor{block title alerted}{%
|
||||||
|
use={block title, alerted text},
|
||||||
|
bg=block title.bg,
|
||||||
|
fg=alerted text.fg
|
||||||
|
}
|
||||||
|
\setbeamercolor{block title example}{%
|
||||||
|
use={block title, example text},
|
||||||
|
bg=block title.bg,
|
||||||
|
fg=example text.fg
|
||||||
|
}
|
||||||
|
|
||||||
|
\setbeamercolor{block body alerted}{use=block body, parent=block body}
|
||||||
|
\setbeamercolor{block body example}{use=block body, parent=block body}
|
||||||
|
\setbeamercolor{block body}{
|
||||||
|
use={block title, normal text},
|
||||||
|
bg=block title.bg!50!normal text.bg
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
% Footnotes
|
||||||
|
|
||||||
|
\setbeamercolor{footnote}{fg=normal text.fg!90}
|
||||||
|
\setbeamercolor{footnote mark}{fg=.}
|
||||||
|
|
||||||
|
|
||||||
\mode<all>
|
\mode<all>
|
||||||
|
|
|
@ -170,7 +170,8 @@
|
||||||
\fi
|
\fi
|
||||||
|
|
||||||
\begin{tikzpicture}
|
\begin{tikzpicture}
|
||||||
\draw[alerted text.fg] (0, 0) -- (\textwidth, 0);
|
\usebeamercolor{title separator}
|
||||||
|
\draw[fg] (0, 0) -- (\textwidth, 0);
|
||||||
\end{tikzpicture}%
|
\end{tikzpicture}%
|
||||||
\vspace*{1em}%
|
\vspace*{1em}%
|
||||||
|
|
||||||
|
@ -219,10 +220,10 @@
|
||||||
\setlength{\progressbar@percent}{%
|
\setlength{\progressbar@percent}{%
|
||||||
#1 * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}%
|
#1 * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}%
|
||||||
}%
|
}%
|
||||||
\usebeamercolor{palette primary}
|
|
||||||
\begin{tikzpicture}[tight background]
|
\begin{tikzpicture}[tight background]
|
||||||
\draw[fg!50, fill=fg!50] (0,0) rectangle (#1, 0.4pt);
|
\usebeamercolor{progress bar}
|
||||||
\draw[alerted text.fg, fill=alerted text.fg] (0,0) rectangle (\progressbar@percent, 0.4pt);
|
\draw[bg, fill=bg] (0,0) rectangle (#1, 0.4pt);
|
||||||
|
\draw[fg, fill=fg] (0,0) rectangle (\progressbar@percent, 0.4pt);
|
||||||
\end{tikzpicture}%
|
\end{tikzpicture}%
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,11 +238,16 @@
|
||||||
|
|
||||||
\newcommand{\plain}[2][]{%
|
\newcommand{\plain}[2][]{%
|
||||||
\begingroup
|
\begingroup
|
||||||
\setbeamercolor{background canvas}{use=palette primary,bg=palette primary.fg}
|
\setbeamercolor{background canvas}{use=palette primary,parent=palette primary}
|
||||||
\begin{frame}{#1}
|
\begin{frame}{#1}
|
||||||
\centering
|
\centering
|
||||||
\vfill\vspace{1em}\usebeamerfont{section title}\textcolor{white}{\mthemetitleformat{#2}}\vfill
|
\vfill
|
||||||
\end{frame}
|
\vspace{1em}
|
||||||
|
\usebeamercolor[fg]{palette primary}
|
||||||
|
\usebeamerfont{section title}
|
||||||
|
\mthemetitleformat{#2}
|
||||||
|
\vfill
|
||||||
|
\end{frame}
|
||||||
\endgroup
|
\endgroup
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,10 +291,7 @@
|
||||||
\ifbeamer@inframe
|
\ifbeamer@inframe
|
||||||
\sectionpage
|
\sectionpage
|
||||||
\else
|
\else
|
||||||
\begingroup
|
|
||||||
\setbeamercolor{background canvas}{parent=palette primary}
|
|
||||||
\frame[plain]{\sectionpage}
|
\frame[plain]{\sectionpage}
|
||||||
\endgroup
|
|
||||||
\fi
|
\fi
|
||||||
}
|
}
|
||||||
\fi
|
\fi
|
||||||
|
@ -305,7 +308,7 @@
|
||||||
\usenavigationsymbolstemplate{}
|
\usenavigationsymbolstemplate{}
|
||||||
\setbeamertemplate{footline}
|
\setbeamertemplate{footline}
|
||||||
{%
|
{%
|
||||||
\begin{beamercolorbox}[wd=\textwidth,ht=3ex,dp=3ex,leftskip=0.3cm,rightskip=0.3cm]{structure}%
|
\begin{beamercolorbox}[wd=\textwidth,ht=3ex,dp=3ex,leftskip=0.3cm,rightskip=0.3cm]{footline}%
|
||||||
\hfill\usebeamerfont{page number in head/foot}%
|
\hfill\usebeamerfont{page number in head/foot}%
|
||||||
\if@noSlideNumbers%
|
\if@noSlideNumbers%
|
||||||
%Purposefully left blank to display no slide number.%
|
%Purposefully left blank to display no slide number.%
|
||||||
|
|
Loading…
Reference in New Issue