%%%%% Package ``beamertheme-light'': a colored beamer theme %%%%%
%%%%% Authors: Fabien Vergnet and Vivien Goepp %%%%%
%%%%% Contact: f.j.vergnet@gmail.com and vivien.goepp@gmail.com %%%%%
%%%%% Package version 1.0 (29/01/2019) %%%%%

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{light}[2019/01/29 Beamer style package]

\mode<presentation>

%%%%% Define colors %%%%%
% Defaut:
\definecolor{vertfonce}{rgb}{0.20,0.43,0.09} 
% Blue:
\definecolor{frenchblue}{rgb}{0.0, 0.45, 0.73}
\definecolor{sanddune}{rgb}{0.59, 0.44, 0.09}
% Purple:
\definecolor{darkmagenta}{rgb}{0.55, 0.0, 0.55}
\definecolor{byzantium}{rgb}{0.44, 0.16, 0.39}
\definecolor{sanddune}{rgb}{0.59, 0.44, 0.09}
% Beige:
\definecolor{darkpastelred}{rgb}{0.76, 0.23, 0.13}
\definecolor{desertsand}{rgb}{0.93, 0.79, 0.69}

%%%%% Define body and title colors %%%%%
%% Foreground colors
\newcommand{\wordcolor}{vertfonce} % Text color
%% Optional colors
\DeclareOption{blue}{\renewcommand{\wordcolor}{frenchblue}}
\DeclareOption{red}{\renewcommand{\wordcolor}{darkpastelred}}
\DeclareOption{purple}{\renewcommand{\wordcolor}{darkmagenta}}
\DeclareOption*{\PackageWarning{descartes}{Unknown ‘\CurrentOption’}}
\ProcessOptions\relax

%% Background colors
\newcommand{\strbg}{white!90!black} % Structure background color
\DeclareOption{blue}{\renewcommand{\strbg}{sanddune!15!white}}
\DeclareOption{red}{\renewcommand{\strbg}{desertsand!30!white}}
\DeclareOption{purple}{\renewcommand{\strbg}{byzantium!25!white}}
\DeclareOption*{\PackageWarning{descartes}{Unknown ‘\CurrentOption’}}
\ProcessOptions\relax

%% Set colors
\setbeamercolor{title in head/foot}{fg=\wordcolor,bg=white!90!black}
\setbeamercolor{structure}{fg=\wordcolor,bg=\strbg}
\setbeamercolor{title}{fg=\wordcolor,bg=white}

%%%%% Define title frame %%%%%
\defbeamertemplate*{title page}{customized}[1][]
{
  \vspace{1cm}
  \usebeamerfont{title}\usebeamercolor[fg]{title}\center{\huge \inserttitle}\par
   \center{\rule{0.6666\paperwidth}{0.02cm}\par}
  \bigskip
  \usebeamerfont{author}\usebeamercolor[black]{author}{\large \insertauthor}\\
  \bigskip
  \usebeamerfont{institute}{\small \insertinstitute}\par
  \bigskip
  \vspace{1cm}
  \usebeamerfont{date}{\small \insertdate}\par
}
%%%%% End define title frame %%%%%

%%%%% Define footline %%%%%
\setbeamertemplate{footline}
{
  \leavevmode%
  \hbox{%
  \begin{beamercolorbox}[wd =.45\paperwidth, ht = 2.25ex, dp = 1ex, center]{author in head/foot}%
    \usebeamerfont{author in head/foot}\colorbox{structure.bg}{\makebox[0.45\paperwidth]{\insertshortauthor}}
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd =.45\paperwidth, ht = 2.25ex, dp = 1ex, center]{title in head/foot}%
    \usebeamerfont{title in head/foot}\colorbox{structure.bg}{\makebox[0.45\paperwidth]{\insertshorttitle}}
  \end{beamercolorbox}%
  \begin{beamercolorbox}[wd=.10\paperwidth, ht = 2.25ex, dp = 1ex, right]{date in head/foot}%
    \usebeamerfont{date in head/foot}\colorbox{structure.bg}{\makebox[0.10\paperwidth]{
    \insertframenumber{} / \inserttotalframenumber\hspace*{2ex}}}
  \end{beamercolorbox}}%
  \vskip0pt%
}
%%%%% End define footline %%%%%

%%%%% Define command for the "Thank you" frame
\newcommand{\thankframe}[1]{
\setbeamercolor{background canvas}{fg = title.fg,bg = title.fg!50!black}
\setbeamertemplate{footline}{}
\begin{frame}
	\center{\Huge \textcolor{white}{#1}}
\end{frame}
\setbeamercolor{structure}{fg = \wordcolor, bg = \strbg}
\setbeamercolor{background canvas}{fg = black,bg = white}
}
%%%%% End define command for the "Thank you" frame

%% Rounded block (for definition, prop, theorems, etc...)
\setbeamertemplate{blocks}[rounded][shadow = true]

%% No navigation symbols
\setbeamertemplate{navigation symbols}{}

%% Redefine itemize
\setbeamercolor{item}{fg = title.fg, bg = title.fg}
\setbeamertemplate{itemize item}{{\tiny{\textbullet}}}

%% Redefine the way the legend of a figure is written
\setbeamertemplate{caption}{\raggedright\scriptsize{\insertcaption}\par}

%% To have "[number]" before any reference in bibliography
\setbeamertemplate{bibliography item}[text]

%% Remove 1 from the counter (title frame is 0)
\addtocounter{framenumber}{-1}

\mode
<all>
