From be7f8b0553fc3e3d976621db5855c67226b3f115 Mon Sep 17 00:00:00 2001 From: Johann Dahm Date: Thu, 22 Jan 2015 20:39:09 -0500 Subject: [PATCH 1/9] Use palette colors instead of hardcoded names. --- beamerthemem.sty | 66 ++++++++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/beamerthemem.sty b/beamerthemem.sty index f3a8aa6..c5db9f0 100644 --- a/beamerthemem.sty +++ b/beamerthemem.sty @@ -55,7 +55,7 @@ {\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par}% \vspace*{0.5em} \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} \ifx\insertauthor\@empty% \else% @@ -93,45 +93,51 @@ % the progress bar \def\progressbar@sectionprogressbar{% - \progressbar@tmpcounta=\insertframenumber - \progressbar@tmpcountb=\inserttotalframenumber - \progressbar@tmpdim=\progressbar@pbwd + {\usebeamercolor{palette primary}% + \progressbar@tmpcounta=\insertframenumber + \progressbar@tmpcountb=\inserttotalframenumber + \progressbar@tmpdim=\progressbar@pbwd \divide\progressbar@tmpdim by 100 - \multiply\progressbar@tmpdim by \progressbar@tmpcounta - \divide\progressbar@tmpdim by \progressbar@tmpcountb + \multiply\progressbar@tmpdim by \progressbar@tmpcounta + \divide\progressbar@tmpdim by \progressbar@tmpcountb \multiply\progressbar@tmpdim by 100 - \makebox[\textwidth][c]{ - \begin{tikzpicture}[tight background] + \makebox[\textwidth][c]{ + \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] - (2pt, -16pt) rectangle ++ (\progressbar@pbwd, \progressbar@pbht); + \draw[anchor=west, fg!20, fill=fg!20, inner sep=0pt] + (2pt, -16pt) rectangle ++ (\progressbar@pbwd, \progressbar@pbht); - \draw[anchor=west, mDarkTeal, fill=mDarkTeal, inner sep=0pt] - (2pt, -16pt) rectangle ++ (\progressbar@tmpdim, \progressbar@pbht); - \end{tikzpicture}% - } + \draw[anchor=west, fg, fill=fg, inner sep=0pt] + (2pt, -16pt) rectangle ++ (\progressbar@tmpdim, \progressbar@pbht); + \end{tikzpicture}% + } + } % end usebeamercolor{palette primary} } \if@useTitleProgressBar - \def\progressbar@titleprogressbar{% - \progressbar@tmpcounta=\insertframenumber - \progressbar@tmpcountb=\inserttotalframenumber - \progressbar@tmpdim=\paperwidth - \divide\progressbar@tmpdim by 100 - \multiply\progressbar@tmpdim by \progressbar@tmpcounta - \divide\progressbar@tmpdim by \progressbar@tmpcountb - \multiply\progressbar@tmpdim by 100 +\def\progressbar@titleprogressbar{% + \progressbar@tmpcounta=\insertframenumber + \progressbar@tmpcountb=\inserttotalframenumber + \progressbar@tmpdim=\paperwidth + \divide\progressbar@tmpdim by 100 + \multiply\progressbar@tmpdim by \progressbar@tmpcounta + \divide\progressbar@tmpdim by \progressbar@tmpcountb + \multiply\progressbar@tmpdim by 100 + {% + \usebeamercolor{palette quaternary}% + \usebeamercolor{alerted text}% \begin{tikzpicture}[tight background] - \draw[mDarkBrown, fill=mDarkBrown] (0, 0) rectangle ($(\paperwidth, 0.2pt) - (0.4pt, 0)$); - \draw[mLightBrown, fill=mLightBrown] (0, 0) rectangle (\progressbar@tmpdim, 0.2pt); - \end{tikzpicture} - } + \draw[palette quaternary.fg, fill=palette quaternary.fg] (0, 0) rectangle ($(\paperwidth, 0.2pt) - (0.4pt, 0)$); + \draw[alerted text.fg, fill=alerted text.fg] (0, 0) rectangle (\progressbar@tmpdim, 0.2pt); + \end{tikzpicture}% + }% +} \fi -%}}} +% }}} %{{{ --- Commands --------------------- \newcommand{\insertsectionHEAD}{% @@ -141,7 +147,7 @@ \newcommand{\plain}[2][]{% \begingroup - \setbeamercolor{background canvas}{bg=mDarkTeal} + \setbeamercolor{background canvas}{use=palette primary,bg=palette primary.fg} \begin{frame}{#1} \centering \vfill\vspace{1em}\usebeamerfont{section title}\textcolor{white}{\scshape #2}\vfill @@ -172,7 +178,7 @@ \AtBeginSection[] { \begingroup - \setbeamercolor{background canvas}{bg=black!2} + \setbeamercolor{background canvas}{parent=palette primary} \begin{frame}[plain] \vspace{2em}\usebeamerfont{section title} \progressbar@sectionprogressbar% From 20a76b05f7107af296c5a560d1cb36a6cb478fff Mon Sep 17 00:00:00 2001 From: Johann Dahm Date: Thu, 22 Jan 2015 20:41:41 -0500 Subject: [PATCH 2/9] Added block colors. --- beamercolorthememetropolis.sty | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/beamercolorthememetropolis.sty b/beamercolorthememetropolis.sty index 41b7e24..dcb4368 100644 --- a/beamercolorthememetropolis.sty +++ b/beamercolorthememetropolis.sty @@ -39,5 +39,13 @@ \setbeamercolor{footnote}{fg=mDarkTeal!50} \setbeamercolor{page number in head/foot}{fg=mDarkTeal} +\setbeamercolor{block title}{parent=palette secondary} +\setbeamercolor{block title alerted}{use=alerted text,fg=mDarkTeal,bg=alerted text.fg!75!bg} +\setbeamercolor{block title example}{use=example text,fg=mDarkTeal,bg=example text.fg!75!bg} + +\setbeamercolor{block body}{parent=normal text,use=block title,bg=block title.bg!25!bg} +\setbeamercolor{block body alerted}{parent=normal text,use=block title alerted,bg=block title alerted.bg!25!bg} +\setbeamercolor{block body example}{parent=normal text,use=block title example,bg=block title example.bg!25!bg} + \mode From c0a88c8e1de681fb037269eab40089c30f336a7f Mon Sep 17 00:00:00 2001 From: Johann Dahm Date: Thu, 22 Jan 2015 20:48:31 -0500 Subject: [PATCH 3/9] Added *.fls to .gitignore. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index fa12266..2d7b963 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ demo.pdf +*.fls *.acn *.acr *.alg From 9e24bba520743240410ab41a4f30d36dace11843 Mon Sep 17 00:00:00 2001 From: Johann Dahm Date: Thu, 22 Jan 2015 20:39:09 -0500 Subject: [PATCH 4/9] Use palette colors instead of hardcoded names. --- beamerthemem.sty | 66 ++++++++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/beamerthemem.sty b/beamerthemem.sty index f3a8aa6..c5db9f0 100644 --- a/beamerthemem.sty +++ b/beamerthemem.sty @@ -55,7 +55,7 @@ {\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par}% \vspace*{0.5em} \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} \ifx\insertauthor\@empty% \else% @@ -93,45 +93,51 @@ % the progress bar \def\progressbar@sectionprogressbar{% - \progressbar@tmpcounta=\insertframenumber - \progressbar@tmpcountb=\inserttotalframenumber - \progressbar@tmpdim=\progressbar@pbwd + {\usebeamercolor{palette primary}% + \progressbar@tmpcounta=\insertframenumber + \progressbar@tmpcountb=\inserttotalframenumber + \progressbar@tmpdim=\progressbar@pbwd \divide\progressbar@tmpdim by 100 - \multiply\progressbar@tmpdim by \progressbar@tmpcounta - \divide\progressbar@tmpdim by \progressbar@tmpcountb + \multiply\progressbar@tmpdim by \progressbar@tmpcounta + \divide\progressbar@tmpdim by \progressbar@tmpcountb \multiply\progressbar@tmpdim by 100 - \makebox[\textwidth][c]{ - \begin{tikzpicture}[tight background] + \makebox[\textwidth][c]{ + \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] - (2pt, -16pt) rectangle ++ (\progressbar@pbwd, \progressbar@pbht); + \draw[anchor=west, fg!20, fill=fg!20, inner sep=0pt] + (2pt, -16pt) rectangle ++ (\progressbar@pbwd, \progressbar@pbht); - \draw[anchor=west, mDarkTeal, fill=mDarkTeal, inner sep=0pt] - (2pt, -16pt) rectangle ++ (\progressbar@tmpdim, \progressbar@pbht); - \end{tikzpicture}% - } + \draw[anchor=west, fg, fill=fg, inner sep=0pt] + (2pt, -16pt) rectangle ++ (\progressbar@tmpdim, \progressbar@pbht); + \end{tikzpicture}% + } + } % end usebeamercolor{palette primary} } \if@useTitleProgressBar - \def\progressbar@titleprogressbar{% - \progressbar@tmpcounta=\insertframenumber - \progressbar@tmpcountb=\inserttotalframenumber - \progressbar@tmpdim=\paperwidth - \divide\progressbar@tmpdim by 100 - \multiply\progressbar@tmpdim by \progressbar@tmpcounta - \divide\progressbar@tmpdim by \progressbar@tmpcountb - \multiply\progressbar@tmpdim by 100 +\def\progressbar@titleprogressbar{% + \progressbar@tmpcounta=\insertframenumber + \progressbar@tmpcountb=\inserttotalframenumber + \progressbar@tmpdim=\paperwidth + \divide\progressbar@tmpdim by 100 + \multiply\progressbar@tmpdim by \progressbar@tmpcounta + \divide\progressbar@tmpdim by \progressbar@tmpcountb + \multiply\progressbar@tmpdim by 100 + {% + \usebeamercolor{palette quaternary}% + \usebeamercolor{alerted text}% \begin{tikzpicture}[tight background] - \draw[mDarkBrown, fill=mDarkBrown] (0, 0) rectangle ($(\paperwidth, 0.2pt) - (0.4pt, 0)$); - \draw[mLightBrown, fill=mLightBrown] (0, 0) rectangle (\progressbar@tmpdim, 0.2pt); - \end{tikzpicture} - } + \draw[palette quaternary.fg, fill=palette quaternary.fg] (0, 0) rectangle ($(\paperwidth, 0.2pt) - (0.4pt, 0)$); + \draw[alerted text.fg, fill=alerted text.fg] (0, 0) rectangle (\progressbar@tmpdim, 0.2pt); + \end{tikzpicture}% + }% +} \fi -%}}} +% }}} %{{{ --- Commands --------------------- \newcommand{\insertsectionHEAD}{% @@ -141,7 +147,7 @@ \newcommand{\plain}[2][]{% \begingroup - \setbeamercolor{background canvas}{bg=mDarkTeal} + \setbeamercolor{background canvas}{use=palette primary,bg=palette primary.fg} \begin{frame}{#1} \centering \vfill\vspace{1em}\usebeamerfont{section title}\textcolor{white}{\scshape #2}\vfill @@ -172,7 +178,7 @@ \AtBeginSection[] { \begingroup - \setbeamercolor{background canvas}{bg=black!2} + \setbeamercolor{background canvas}{parent=palette primary} \begin{frame}[plain] \vspace{2em}\usebeamerfont{section title} \progressbar@sectionprogressbar% From dabd171261b09c8f6ae2d053e4a292c3478a5836 Mon Sep 17 00:00:00 2001 From: Johann Dahm Date: Thu, 22 Jan 2015 20:41:41 -0500 Subject: [PATCH 5/9] Added block colors. --- beamercolorthememetropolis.sty | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/beamercolorthememetropolis.sty b/beamercolorthememetropolis.sty index 21914cf..98baa39 100644 --- a/beamercolorthememetropolis.sty +++ b/beamercolorthememetropolis.sty @@ -40,5 +40,13 @@ \setbeamercolor{footnote mark}{fg=.} \setbeamercolor{page number in head/foot}{fg=mDarkTeal} +\setbeamercolor{block title}{parent=palette secondary} +\setbeamercolor{block title alerted}{use=alerted text,fg=mDarkTeal,bg=alerted text.fg!75!bg} +\setbeamercolor{block title example}{use=example text,fg=mDarkTeal,bg=example text.fg!75!bg} + +\setbeamercolor{block body}{parent=normal text,use=block title,bg=block title.bg!25!bg} +\setbeamercolor{block body alerted}{parent=normal text,use=block title alerted,bg=block title alerted.bg!25!bg} +\setbeamercolor{block body example}{parent=normal text,use=block title example,bg=block title example.bg!25!bg} + \mode From 05f877788ccd39dd417cf8b1c43f6a2a3cd46b04 Mon Sep 17 00:00:00 2001 From: Johann Dahm Date: Thu, 22 Jan 2015 20:48:31 -0500 Subject: [PATCH 6/9] Added *.fls to .gitignore. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index fa12266..2d7b963 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ demo.pdf +*.fls *.acn *.acr *.alg From 92a068fe32235d07b2cdcce0f0031f4ce5b8486a Mon Sep 17 00:00:00 2001 From: Johann Dahm Date: Wed, 28 Jan 2015 20:24:32 -0500 Subject: [PATCH 7/9] Added 'blockbg' option to metropolis color theme. Still inaccessible from theme. --- beamercolorthememetropolis.sty | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/beamercolorthememetropolis.sty b/beamercolorthememetropolis.sty index 98baa39..25b2a35 100644 --- a/beamercolorthememetropolis.sty +++ b/beamercolorthememetropolis.sty @@ -9,6 +9,13 @@ \ProvidesPackage{beamercolorthememetropolis} +\newif\if@blockbg +\@blockbgfalse +\DeclareOption{blockbg}{\@blockbgtrue} + +\ProcessOptions\relax + + % http://paletton.com/#uid=7050t0kkJkJsntwoyp6gYgoddc4 \definecolor{mDarkBrown}{HTML}{604c38} @@ -40,13 +47,17 @@ \setbeamercolor{footnote mark}{fg=.} \setbeamercolor{page number in head/foot}{fg=mDarkTeal} -\setbeamercolor{block title}{parent=palette secondary} -\setbeamercolor{block title alerted}{use=alerted text,fg=mDarkTeal,bg=alerted text.fg!75!bg} -\setbeamercolor{block title example}{use=example text,fg=mDarkTeal,bg=example text.fg!75!bg} +\if@blockbg -\setbeamercolor{block body}{parent=normal text,use=block title,bg=block title.bg!25!bg} -\setbeamercolor{block body alerted}{parent=normal text,use=block title alerted,bg=block title alerted.bg!25!bg} -\setbeamercolor{block body example}{parent=normal text,use=block title example,bg=block title example.bg!25!bg} +\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 From e0a8600ba29049b19a1cb2a8cbbc51dcb64ac070 Mon Sep 17 00:00:00 2001 From: Johann Dahm Date: Wed, 28 Jan 2015 23:13:06 -0500 Subject: [PATCH 8/9] Pass option 'blockbg' through to colortheme package. Also, use beamer-specific DeclareOption and error if incorrect options are passed. --- beamercolorthememetropolis.sty | 20 +++++++++++++++----- beamerthemem.sty | 32 ++++++++++++++++++++------------ 2 files changed, 35 insertions(+), 17 deletions(-) diff --git a/beamercolorthememetropolis.sty b/beamercolorthememetropolis.sty index 25b2a35..4641254 100644 --- a/beamercolorthememetropolis.sty +++ b/beamercolorthememetropolis.sty @@ -9,12 +9,22 @@ \ProvidesPackage{beamercolorthememetropolis} -\newif\if@blockbg -\@blockbgfalse -\DeclareOption{blockbg}{\@blockbgtrue} -\ProcessOptions\relax +%}}} +%{{{ --- 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 @@ -47,7 +57,7 @@ \setbeamercolor{footnote mark}{fg=.} \setbeamercolor{page number in head/foot}{fg=mDarkTeal} -\if@blockbg +\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} diff --git a/beamerthemem.sty b/beamerthemem.sty index c5db9f0..19e6277 100644 --- a/beamerthemem.sty +++ b/beamerthemem.sty @@ -9,6 +9,26 @@ \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 --------------------- \usepackage[no-math]{fontspec} @@ -22,18 +42,6 @@ \usecolortheme{metropolis} \usefonttheme{metropolis} -%}}} -%{{{ --- Options ---------------------- - -\newif\if@useTitleProgressBar -\@useTitleProgressBarfalse -\DeclareOption{titleprogressbar}{\@useTitleProgressBartrue} - -\newif\if@protectFrameTitle -\@protectFrameTitlefalse -\DeclareOption{protectframetitle}{\@protectFrameTitletrue} - -\ProcessOptions\relax %}}} %{{{ --- Titlepage -------------------- From a58c8e45028cf66b3493f44bd4ae28a7458be5cb Mon Sep 17 00:00:00 2001 From: Johann Dahm Date: Wed, 28 Jan 2015 23:26:34 -0500 Subject: [PATCH 9/9] Updated README for 'blockbg' option. --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 30d5c99..24569a4 100644 --- a/README.md +++ b/README.md @@ -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 `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