mirror of https://github.com/matze/mtheme.git
Base block spacing on bg colour, not theme option
This commit is contained in:
parent
c997553cad
commit
653826403e
|
@ -357,10 +357,6 @@ The list of options is structured as shown in the following example.
|
|||
|
||||
|
||||
\subsubsection{Inner theme}
|
||||
\DescribeOption{block}{transparent, fill}{transparent}{
|
||||
Optionally adds a light grey background to block environments like |theorem|
|
||||
and |example|.
|
||||
}
|
||||
|
||||
\DescribeOption{sectionpage}{none, simple, progressbar}{progressbar}{
|
||||
Adds a slide at the start of each section (|simple|) with an optional thin
|
||||
|
@ -416,6 +412,7 @@ terms of three beamer colors:
|
|||
\item |alerted text| (colored fg, should be visible against dark or light)
|
||||
\item |example text| (colored fg, should be visible against dark or light)
|
||||
\end{itemize}
|
||||
|
||||
An easy way to customize the theme is to redefine these colors using
|
||||
|
||||
\begin{lstlisting}
|
||||
|
|
|
@ -41,7 +41,8 @@
|
|||
% \subsubsection{Options}
|
||||
%
|
||||
% \begin{macro}{block}
|
||||
% Controls whether block environments are filled or transparent.
|
||||
% Optionally adds a light grey background to block environments like
|
||||
% |theorem| and |example|.
|
||||
% \begin{macrocode}
|
||||
\pgfkeys{
|
||||
/metropolis/color/block/.cd,
|
||||
|
@ -176,11 +177,22 @@
|
|||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Blocks
|
||||
% Block environments such as |theorem| and |example| have no background color
|
||||
% by default. The option |block=fill| sets a background color based on the
|
||||
% background and foreground of |normal text|. The option |block=transparent|
|
||||
% reverts the block environments to an empty background, which can be useful
|
||||
% if changing colors mid-presentation.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\newcommand{\metropolis@block@transparent}{
|
||||
\setbeamercolor{block title}{use=normal text, parent=normal text}
|
||||
\setbeamercolor{block title}{%
|
||||
use=normal text,
|
||||
fg=normal text.fg,
|
||||
bg=
|
||||
}
|
||||
\setbeamercolor{block body}{
|
||||
bg=
|
||||
}
|
||||
}
|
||||
\newcommand{\metropolis@block@fill}{
|
||||
\setbeamercolor{block title}{%
|
||||
|
@ -188,6 +200,10 @@
|
|||
fg=normal text.fg,
|
||||
bg=normal text.bg!80!fg
|
||||
}
|
||||
\setbeamercolor{block body}{
|
||||
use={block title, normal text},
|
||||
bg=block title.bg!50!normal text.bg
|
||||
}
|
||||
}
|
||||
\setbeamercolor{block title alerted}{%
|
||||
use={block title, alerted text},
|
||||
|
@ -201,10 +217,6 @@
|
|||
}
|
||||
\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
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Footnotes
|
||||
|
|
|
@ -55,18 +55,6 @@
|
|||
%
|
||||
% \subsubsection{Options}
|
||||
%
|
||||
% \begin{macro}{block}
|
||||
% This option controls the block style.
|
||||
% \begin{macrocode}
|
||||
\pgfkeys{
|
||||
/metropolis/inner/block/.cd,
|
||||
.is choice,
|
||||
transparent/.code=\setlength{\metropolis@blockskip}{0ex},
|
||||
fill/.code=\setlength{\metropolis@blockskip}{1ex},
|
||||
}
|
||||
% \end{macrocode}
|
||||
% \end{macro}
|
||||
%
|
||||
% \begin{macro}{sectionpage}
|
||||
% The |sectionpage| option defines the behaviour of the sectionpage.
|
||||
% \begin{macrocode}
|
||||
|
@ -86,7 +74,6 @@
|
|||
\newcommand{\metropolis@inner@setdefaults}{
|
||||
\pgfkeys{/metropolis/inner/.cd,
|
||||
sectionpage=progressbar,
|
||||
block=transparent,
|
||||
}
|
||||
}
|
||||
% \end{macrocode}
|
||||
|
@ -328,87 +315,70 @@
|
|||
%
|
||||
% \subsubsection{Block environments}
|
||||
%
|
||||
% Regular block environment
|
||||
%
|
||||
% \begin{macro}{block}
|
||||
% \begin{macro}{block alerted}
|
||||
% \begin{macro}{block example}
|
||||
%
|
||||
% The three different block environments differ only in their colours.
|
||||
% Rather than repeat the essentially the same template three times, we use
|
||||
% the auxiliary macro |\metropolis@block| to define all three templates.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\newlength{\metropolis@blockskip}
|
||||
\setbeamertemplate{block begin}{%
|
||||
\newlength{\metropolis@blocktitleskip}
|
||||
\newlength{\metropolis@blockbodyskip}
|
||||
\newcommand{\metropolis@block}[1]{
|
||||
\setlength{\parskip}{\metropolis@parskip}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% If a background color is defined for the block title or body, a little
|
||||
% bit of padding is added to the corresponding box.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\ifbeamercolorempty[bg]{block title}
|
||||
{\setlength{\metropolis@blocktitleskip}{0ex}}
|
||||
{\setlength{\metropolis@blocktitleskip}{1ex}}
|
||||
\ifbeamercolorempty[bg]{block body}
|
||||
{\setlength{\metropolis@blockbodyskip}{0ex}}
|
||||
{\setlength{\metropolis@blockbodyskip}{1ex}}
|
||||
\vspace*{1ex}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Each block environment consists of two (possibly coloured) beamer boxes:
|
||||
% one for the title and one for the body.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\begin{beamercolorbox}[%
|
||||
ht=2.4ex,
|
||||
dp=1ex,
|
||||
leftskip=\metropolis@blockskip,
|
||||
rightskip=\metropolis@blockskip]{block title}
|
||||
\usebeamerfont*{block title}\insertblocktitle%
|
||||
leftskip=\metropolis@blocktitleskip,
|
||||
rightskip=\metropolis@blocktitleskip]{block title#1}
|
||||
\usebeamerfont*{block title#1}\insertblocktitle%
|
||||
\end{beamercolorbox}%
|
||||
\vspace*{-1pt}
|
||||
\usebeamerfont{block body}%
|
||||
\nointerlineskip%
|
||||
\usebeamerfont{block body#1}%
|
||||
\begin{beamercolorbox}[%
|
||||
dp=1ex,
|
||||
leftskip=\metropolis@blockskip,
|
||||
rightskip=\metropolis@blockskip,
|
||||
vmode]{block body}%
|
||||
}
|
||||
\setbeamertemplate{block end}{%
|
||||
\end{beamercolorbox}
|
||||
\vspace*{0.2ex}
|
||||
leftskip=\metropolis@blockbodyskip,
|
||||
rightskip=\metropolis@blockbodyskip,
|
||||
vmode]{block body#1}%
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Alerted block environment
|
||||
% This concludes the auxiliary macro |\metropolis@block|. Next,
|
||||
% we define the block beamer templates using this macro.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\setbeamertemplate{block alerted begin}{%
|
||||
\setlength{\parskip}{\metropolis@parskip}
|
||||
\vspace*{1ex}
|
||||
\begin{beamercolorbox}[%
|
||||
ht=2.4ex,
|
||||
dp=1ex,
|
||||
leftskip=\metropolis@blockskip,
|
||||
rightskip=\metropolis@blockskip]{block title alerted}
|
||||
\usebeamerfont*{block title alerted}\insertblocktitle%
|
||||
\end{beamercolorbox}%
|
||||
\vspace*{-1pt}
|
||||
\usebeamerfont{block body alerted}%
|
||||
\begin{beamercolorbox}[%
|
||||
dp=1ex,
|
||||
leftskip=\metropolis@blockskip,
|
||||
rightskip=\metropolis@blockskip,
|
||||
vmode]{block body alerted}%
|
||||
}
|
||||
\setbeamertemplate{block alerted end}{%
|
||||
\end{beamercolorbox}
|
||||
\vspace*{0.2ex}
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Example block environment
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\setbeamertemplate{block example begin}{%
|
||||
\setlength{\parskip}{\metropolis@parskip}
|
||||
\vspace*{1ex}
|
||||
\begin{beamercolorbox}[%
|
||||
ht=2.4ex,
|
||||
dp=1ex,
|
||||
leftskip=\metropolis@blockskip,
|
||||
rightskip=\metropolis@blockskip]{block title example}
|
||||
\usebeamerfont*{block title example}\insertblocktitle%
|
||||
\end{beamercolorbox}%
|
||||
\vspace*{-1pt}
|
||||
\usebeamerfont{block body example}%
|
||||
\begin{beamercolorbox}[%
|
||||
dp=1ex,
|
||||
leftskip=\metropolis@blockskip,
|
||||
rightskip=\metropolis@blockskip,
|
||||
vmode]{block body example}%
|
||||
}
|
||||
\setbeamertemplate{block example end}{%
|
||||
\end{beamercolorbox}
|
||||
\vspace*{0.2ex}
|
||||
}
|
||||
\setbeamertemplate{block begin}{\metropolis@block{}}
|
||||
\setbeamertemplate{block alerted begin}{\metropolis@block{ alerted}}
|
||||
\setbeamertemplate{block example begin}{\metropolis@block{ example}}
|
||||
\setbeamertemplate{block end}{\end{beamercolorbox}\vspace*{0.2ex}}
|
||||
\setbeamertemplate{block alerted end}{\end{beamercolorbox}\vspace*{0.2ex}}
|
||||
\setbeamertemplate{block example end}{\end{beamercolorbox}\vspace*{0.2ex}}
|
||||
% \end{macrocode}
|
||||
% \end{macro}
|
||||
% \end{macro}
|
||||
% \end{macro}
|
||||
%
|
||||
%
|
||||
%
|
||||
|
|
|
@ -55,17 +55,7 @@
|
|||
/metropolis/outer,
|
||||
/metropolis/color,
|
||||
/metropolis/font,
|
||||
},
|
||||
% \end{macrocode}
|
||||
%
|
||||
% Currently, the |block| option affects two subthemes and has to be handled
|
||||
% separately.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
block/.code=\pgfkeysalso{
|
||||
inner/block=#1,
|
||||
color/block=#1,
|
||||
},
|
||||
}
|
||||
}
|
||||
% \end{macrocode}
|
||||
%
|
||||
|
|
Loading…
Reference in New Issue