Merge pull request #21 from jdahm/generalcolors

Use palette colors instead of hardcoded names
This commit is contained in:
Matthias Vogelgesang 2015-01-29 22:42:38 +01:00
commit 1469af008c
4 changed files with 89 additions and 42 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
demo.pdf demo.pdf
*.fls
*.acn *.acn
*.acr *.acr
*.alg *.alg

View File

@ -47,6 +47,9 @@ In order to use `\cite`, `\ref` and similar commands in a frame title you have
to protect the title. This can be done automatically with the to protect the title. This can be done automatically with the
`protectframetitle` option. `protectframetitle` option.
The `blockbg` option defines extra colors used in defining the blocks.
The blocks then have a gray background similar to other beamer themes.
#### Commands #### Commands

View File

@ -9,6 +9,23 @@
\ProvidesPackage{beamercolorthememetropolis} \ProvidesPackage{beamercolorthememetropolis}
%}}}
%{{{ --- Options ----------------------
\newif\if@beamer@metropolis@blockbg
\@beamer@metropolis@blockbgfalse
\DeclareOptionBeamer{blockbg}{\@beamer@metropolis@blockbgtrue}
\DeclareOptionBeamer*{%
\PackageWarning{beamercolorthememetropolis}{Unknown option `\CurrentOption'}%
}
\ProcessOptionsBeamer
%}}}
%{{{ --- Colors ---------------------
% http://paletton.com/#uid=7050t0kkJkJsntwoyp6gYgoddc4 % http://paletton.com/#uid=7050t0kkJkJsntwoyp6gYgoddc4
\definecolor{mDarkBrown}{HTML}{604c38} \definecolor{mDarkBrown}{HTML}{604c38}
@ -40,5 +57,17 @@
\setbeamercolor{footnote mark}{fg=.} \setbeamercolor{footnote mark}{fg=.}
\setbeamercolor{page number in head/foot}{fg=mDarkTeal} \setbeamercolor{page number in head/foot}{fg=mDarkTeal}
\if@beamer@metropolis@blockbg
\setbeamercolor{block title}{parent=palette primary,bg=palette primary.bg!80!fg}
\setbeamercolor{block title alerted}{use=alerted text,parent=palette primary,fg=alerted text.fg}
\setbeamercolor{block title example}{use=example text,parent=palette primary,fg=example text.fg}
\setbeamercolor{block body}{parent=normal text,use=block title,bg=block title.bg}
\setbeamercolor{block body alerted}{parent=normal text,use=block title alerted,bg=block title alerted.bg}
\setbeamercolor{block body example}{parent=normal text,use=block title example,bg=block title example.bg}
\fi
\mode \mode
<all> <all>

View File

@ -9,6 +9,26 @@
\ProvidesPackage{beamerthemem} \ProvidesPackage{beamerthemem}
%{{{ --- Options ----------------------
\newif\if@useTitleProgressBar
\@useTitleProgressBarfalse
\DeclareOptionBeamer{useTitleProgressBar}{\@useTitleProgressBartrue}
\newif\if@protectFrameTitle
\@protectFrameTitlefalse
\DeclareOptionBeamer{protectframetitle}{\@protectFrameTitletrue}
\DeclareOptionBeamer{blockbg}{\PassOptionsToPackage{blockbg}{beamercolorthememetropolis}}
\DeclareOptionBeamer*{%
\PackageWarning{beamerthemem}{Unknown option `\CurrentOption'}%
}
\ProcessOptionsBeamer
%}}}
%{{{ --- Packages --------------------- %{{{ --- Packages ---------------------
\usepackage[no-math]{fontspec} \usepackage[no-math]{fontspec}
@ -22,18 +42,6 @@
\usecolortheme{metropolis} \usecolortheme{metropolis}
\usefonttheme{metropolis} \usefonttheme{metropolis}
%}}}
%{{{ --- Options ----------------------
\newif\if@useTitleProgressBar
\@useTitleProgressBarfalse
\DeclareOption{titleprogressbar}{\@useTitleProgressBartrue}
\newif\if@protectFrameTitle
\@protectFrameTitlefalse
\DeclareOption{protectframetitle}{\@protectFrameTitletrue}
\ProcessOptions\relax
%}}} %}}}
%{{{ --- Titlepage -------------------- %{{{ --- Titlepage --------------------
@ -55,7 +63,7 @@
{\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par}% {\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par}%
\vspace*{0.5em} \vspace*{0.5em}
\fi% \fi%
\begin{tikzpicture}\draw[mLightBrown] (0, 0) -- (\textwidth, 0);\end{tikzpicture}% \begin{tikzpicture}\draw[alerted text.fg] (0, 0) -- (\textwidth, 0);\end{tikzpicture}%
\vspace*{1em} \vspace*{1em}
\ifx\insertauthor\@empty% \ifx\insertauthor\@empty%
\else% \else%
@ -93,45 +101,51 @@
% the progress bar % the progress bar
\def\progressbar@sectionprogressbar{% \def\progressbar@sectionprogressbar{%
\progressbar@tmpcounta=\insertframenumber {\usebeamercolor{palette primary}%
\progressbar@tmpcountb=\inserttotalframenumber \progressbar@tmpcounta=\insertframenumber
\progressbar@tmpdim=\progressbar@pbwd \progressbar@tmpcountb=\inserttotalframenumber
\progressbar@tmpdim=\progressbar@pbwd
\divide\progressbar@tmpdim by 100 \divide\progressbar@tmpdim by 100
\multiply\progressbar@tmpdim by \progressbar@tmpcounta \multiply\progressbar@tmpdim by \progressbar@tmpcounta
\divide\progressbar@tmpdim by \progressbar@tmpcountb \divide\progressbar@tmpdim by \progressbar@tmpcountb
\multiply\progressbar@tmpdim by 100 \multiply\progressbar@tmpdim by 100
\makebox[\textwidth][c]{ \makebox[\textwidth][c]{
\begin{tikzpicture}[tight background] \begin{tikzpicture}[tight background]
\node[anchor=west, mDarkTeal, inner sep=0pt] at (0pt, 0pt) {\insertsectionHEAD}; \node[anchor=west, fg, inner sep=0pt] at (0pt, 0pt) {\insertsectionHEAD};
\draw[anchor=west, mDarkTeal!20, fill=mDarkTeal!20, inner sep=0pt] \draw[anchor=west, fg!20, fill=fg!20, inner sep=0pt]
(2pt, -16pt) rectangle ++ (\progressbar@pbwd, \progressbar@pbht); (2pt, -16pt) rectangle ++ (\progressbar@pbwd, \progressbar@pbht);
\draw[anchor=west, mDarkTeal, fill=mDarkTeal, inner sep=0pt] \draw[anchor=west, fg, fill=fg, inner sep=0pt]
(2pt, -16pt) rectangle ++ (\progressbar@tmpdim, \progressbar@pbht); (2pt, -16pt) rectangle ++ (\progressbar@tmpdim, \progressbar@pbht);
\end{tikzpicture}% \end{tikzpicture}%
} }
} % end usebeamercolor{palette primary}
} }
\if@useTitleProgressBar \if@useTitleProgressBar
\def\progressbar@titleprogressbar{% \def\progressbar@titleprogressbar{%
\progressbar@tmpcounta=\insertframenumber \progressbar@tmpcounta=\insertframenumber
\progressbar@tmpcountb=\inserttotalframenumber \progressbar@tmpcountb=\inserttotalframenumber
\progressbar@tmpdim=\paperwidth \progressbar@tmpdim=\paperwidth
\divide\progressbar@tmpdim by 100 \divide\progressbar@tmpdim by 100
\multiply\progressbar@tmpdim by \progressbar@tmpcounta \multiply\progressbar@tmpdim by \progressbar@tmpcounta
\divide\progressbar@tmpdim by \progressbar@tmpcountb \divide\progressbar@tmpdim by \progressbar@tmpcountb
\multiply\progressbar@tmpdim by 100 \multiply\progressbar@tmpdim by 100
{%
\usebeamercolor{palette quaternary}%
\usebeamercolor{alerted text}%
\begin{tikzpicture}[tight background] \begin{tikzpicture}[tight background]
\draw[mDarkBrown, fill=mDarkBrown] (0, 0) rectangle ($(\paperwidth, 0.2pt) - (0.4pt, 0)$); \draw[palette quaternary.fg, fill=palette quaternary.fg] (0, 0) rectangle ($(\paperwidth, 0.2pt) - (0.4pt, 0)$);
\draw[mLightBrown, fill=mLightBrown] (0, 0) rectangle (\progressbar@tmpdim, 0.2pt); \draw[alerted text.fg, fill=alerted text.fg] (0, 0) rectangle (\progressbar@tmpdim, 0.2pt);
\end{tikzpicture} \end{tikzpicture}%
} }%
}
\fi \fi
%}}} % }}}
%{{{ --- Commands --------------------- %{{{ --- Commands ---------------------
\newcommand{\insertsectionHEAD}{% \newcommand{\insertsectionHEAD}{%
@ -141,7 +155,7 @@
\newcommand{\plain}[2][]{% \newcommand{\plain}[2][]{%
\begingroup \begingroup
\setbeamercolor{background canvas}{bg=mDarkTeal} \setbeamercolor{background canvas}{use=palette primary,bg=palette primary.fg}
\begin{frame}{#1} \begin{frame}{#1}
\centering \centering
\vfill\vspace{1em}\usebeamerfont{section title}\textcolor{white}{\scshape #2}\vfill \vfill\vspace{1em}\usebeamerfont{section title}\textcolor{white}{\scshape #2}\vfill
@ -172,7 +186,7 @@
\AtBeginSection[] \AtBeginSection[]
{ {
\begingroup \begingroup
\setbeamercolor{background canvas}{bg=black!2} \setbeamercolor{background canvas}{parent=palette primary}
\begin{frame}[plain] \begin{frame}[plain]
\vspace{2em}\usebeamerfont{section title} \vspace{2em}\usebeamerfont{section title}
\progressbar@sectionprogressbar% \progressbar@sectionprogressbar%