Skip to content

Instantly share code, notes, and snippets.

@walshc
Last active April 13, 2018 02:46
Show Gist options
  • Save walshc/7108cb9d7d88e749024ed676852f28fd to your computer and use it in GitHub Desktop.
Save walshc/7108cb9d7d88e749024ed676852f28fd to your computer and use it in GitHub Desktop.
Material Design Beamer theme.
% Copyright 2016 by Christoph Walsh
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
% Used material from:
% https://github.com/edasubert/beamerMaterialDesign and
% http://ctan.mackichan.com/macros/latex/contrib/beamer/base/themes/outer/beamerouterthememiniframes.sty
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% HOW TO USE: %
% Add \usetheme{material} to the preamble of your beamer document with this %
% file in your path or some directory as your beamer file %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\mode<presentation>
%%%%%%%%%%%%%%%%
% Requirements %
%%%%%%%%%%%%%%%%
\RequirePackage{tikz}
\RequirePackage{xcolor}
\RequirePackage[sfdefault, rm]{roboto}
\RequirePackage[many]{tcolorbox}
%%%%%%%%%%%%%%%%%%
% Define colours %
%%%%%%%%%%%%%%%%%%
\definecolor{textPrimary} {HTML}{FFFFFF}
\definecolor{textAccent} {HTML}{FFFFFF}
\definecolor{text} {HTML}{000000}
\setbeamercolor*{normal text}{fg=text}
\definecolor{shadow}{HTML}{000000}
\definecolor{BGgrey01}{HTML}{E0E0E0}
\definecolor{BGgrey02}{HTML}{F5F5F5}
\definecolor{BGgrey03}{HTML}{FAFAFA}
\definecolor{BGgrey04}{HTML}{FFFFFF}
% Indigo & Pink
\definecolor{primary} {HTML}{3F51B5}
\definecolor{primaryL}{HTML}{C5CAE9}
\definecolor{primaryD}{HTML}{303F9F}
\definecolor{accent}{HTML} {FF4081}
\definecolor{accentL}{HTML}{FF80AB}
\definecolor{accentD}{HTML}{F50057}
\setbeamercolor*{title}{fg=textPrimary}
\setbeamercolor*{author}{fg=textPrimary}
\setbeamercolor*{date}{fg=textPrimary}
\setbeamercolor*{item}{fg=accent}
\setbeamertemplate{navigation symbols}{}
\setbeamerfont*{title}{size=\Large}
\setbeamerfont*{author}{size=\large}
\setbeamerfont*{date}{size=\normalsize}
\setbeamerfont*{frametitle}{size=\large}
%%%%%%%%%%%
% Top bar %
%%%%%%%%%%%
\setbeamertemplate{background}{
\begin{tikzpicture}
\useasboundingbox (0,0) rectangle(\the\paperwidth,\the\paperheight);
\fill[color=BGgrey03] (0,0) rectangle(\the\paperwidth,\the\paperheight);
\fill[color=primaryD] (0,\the\paperheight)
rectangle(\the\paperwidth,0.9\paperheight);
\ifx\insertframetitle\@empty
\ifnum\thepage>1\relax%
\fill[color=BGgrey03] (0,0) rectangle(\the\paperwidth,\the\paperheight);
\fi
\fi
\end{tikzpicture}
}
%%%%%%%%%%%%%%%%%%%%%%%%
% Section name bubbles %
%%%%%%%%%%%%%%%%%%%%%%%%
\setbeamercolor{section in head/foot}{fg = textPrimary, bg = BGgrey03}
\setbeamercolor{subsection in head/foot}{fg = textPrimary, bg = BGgrey03}
\setbeamertemplate{headline}{%
\begin{beamercolorbox}{white}
\insertnavigation{\paperwidth}%
\vspace{-10pt}
\end{beamercolorbox}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Slide counter on the bottom right %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setbeamertemplate{footline}[frame number]
%%%%%%%%%%%%%%
% Title page %
%%%%%%%%%%%%%%
\defbeamertemplate*{title page}{material}[1][]
{
\makebox[\linewidth][c]{%
\begin{minipage}[t][\paperheight]{\paperwidth}
\raggedright
\begin{tcolorbox}[
colback=primary,
enhanced,
sharpish corners=all,
boxrule=0mm,
coltext=textPrimary,
fuzzy shadow={0mm}{-0.6mm}{0mm}{0.2mm}{shadow!40!BGgrey03}, % bottomSmall
fuzzy shadow={0mm}{-0.2mm}{0mm}{0.2mm}{shadow!20!BGgrey03}, % bottomBig
fuzzy shadow={0mm}{ 0.6mm}{0mm}{0.2mm}{shadow!40!primary}, % topSmall
fuzzy shadow={0mm}{ 0.2mm}{0mm}{0.2mm}{shadow!20!primary}, % topBig
width=\paperwidth,
height=0.6\paperheight,
flushright upper,
valign=bottom,
boxsep=0.5cm]
\textrm{\usebeamerfont{title} \inserttitle}\\~\\
\textrm{\usebeamerfont{author}\insertauthor}\\~\\
\textrm{\usebeamerfont{date}\insertdate}
\end{tcolorbox}
\end{minipage}%
}%
\vfill
}
%%%%%%%%%%%%%%%%%%%%%
% Itemize/Enumerate %
%%%%%%%%%%%%%%%%%%%%%
\setbeamertemplate{enumerate items}[circle]
\setbeamertemplate{itemize items}{\Large $\bullet$}
\setbeamertemplate{sections/subsections in toc}[circle]
%%%%%%%%%%%%%%%
% Frame title %
%%%%%%%%%%%%%%%
\defbeamertemplate*{frametitle}{material}[1][]
{
\makebox[\linewidth][c]{%
\begin{minipage}[t]{\paperwidth}
\raggedright
\begin{tcolorbox}[
colback=primary,
enhanced,
sharpish corners=all,
boxrule=0mm,
coltext=textPrimary,
fuzzy shadow={0mm}{-0.9mm}{0mm}{0.2mm}{shadow!40!BGgrey03}, % bottomSmall
fuzzy shadow={0mm}{-0.8mm}{0mm}{0.2mm}{shadow!20!BGgrey03}, % bottomBig
fuzzy shadow={0mm}{ 0.6mm}{0mm}{0.2mm}{shadow!40!primary}, % topSmall
fuzzy shadow={0mm}{ 0.5mm}{0mm}{0.2mm}{shadow!20!primary}, % topBig
width=\paperwidth,
boxsep=2mm]
\ifx\insertframesubtitle\@empty%
{\usebeamerfont{frametitle} \insertframetitle}
\else%
{\usebeamerfont{frametitle} \insertframetitle}
{\usebeamerfont{framesubtitle} \insertframesubtitle}
\fi
\end{tcolorbox}
\end{minipage}%
}%
}
%%%%%%%%%%%%%%%%%%%%%%%
% theorem environment %
%%%%%%%%%%%%%%%%%%%%%%%
\setbeamertemplate{theorem begin}
{%
\normalfont\begin{cardTitle}{\inserttheoremname\inserttheoremnumber%
\ifx
\inserttheoremaddition\@empty
\else
(\inserttheoremaddition)
\fi}%
}
\setbeamertemplate{theorem end}{\end{cardTitle}}
%%%%%%%%%%%%%%%%%%%%
% card environment %
%%%%%%%%%%%%%%%%%%%%
\newenvironment{card}{%
\begin{tcolorbox}[
colback=BGgrey04,
colbacktitle=primary, %
enhanced,
sharpish corners=all,%
fuzzy shadow={0mm}{ 0.9mm}{ 0.6mm}{0.2mm}{shadow!20!BGgrey03}, % top
fuzzy shadow={0mm}{-0.6mm}{-0.1mm}{0.2mm}{shadow!40!BGgrey03}, % bottomSmall
fuzzy shadow={0mm}{-0.2mm}{-0.2mm}{0.2mm}{shadow!20!BGgrey03}, % bottomBig
title filled,
boxrule=0mm,
left=6mm,
right=6mm,
top=6mm,
bottom=6mm,
middle=4mm,
segmentation code={
\path[draw=BGgrey01](segmentation.west) -- (segmentation.east);}]%
}{%
\end{tcolorbox}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%
% cardTitle environment %
%%%%%%%%%%%%%%%%%%%%%%%%%
\newenvironment{cardTitle}[1]{%
\begin{tcolorbox}[
colback=BGgrey04,
colbacktitle=primary, %
enhanced,
sharpish corners=all,%
fuzzy shadow={0mm}{ 0.9mm}{ 0.6mm}{0.2mm}{shadow!20!BGgrey03}, % top
fuzzy shadow={0mm}{-0.6mm}{-0.1mm}{0.2mm}{shadow!40!BGgrey03}, % bottomSmall
fuzzy shadow={0mm}{-0.2mm}{-0.2mm}{0.2mm}{shadow!20!BGgrey03}, % bottomBig
title filled,
boxrule=0mm,
title=#1,
left=6mm,
right=6mm,
top=3mm,
bottom=6mm,
middle=4mm,
toptitle=4mm,
bottomtitle=3mm,
segmentation code={
\path[draw=BGgrey01](segmentation.west) -- (segmentation.east);}]%
}{%
\end{tcolorbox}%
}
\mode<all>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment