%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
% LxStyle - Lxsameer's beamer style
% Copyright (C) 2022 Sameer Rahmani <lxsameer@gnu.org>
%
% This program is free software; you can redistribute it and/or
% modify it under the terms of the GNU General Public License
% as published by the Free Software Foundation; either version 2
% of the License, or (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program; if not, write to the Free Software
% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

\LoadClass[hyperref={pdfpagelabels=false,hidelinks},aspectratio=169,presentation]{beamer}

\ProvidesClass{lxpresent}[2022/09/22 lxsameer's presentation class]
\RequirePackage[default,light,semibold]{sourcesanspro}
\setsansfont{Source Sans Pro}
\RequirePackage{fontspec}
\RequirePackage{xcolor}
\RequirePackage{fontawesome5}
\RequirePackage{tikz}
\RequirePackage{rotating}
\RequirePackage[normalem]{ulem}
\RequirePackage{amsmath}
\RequirePackage{amssymb}
\RequirePackage{capt-of}

\newcommand*{\setep}[2]{\def\@ep{#1}\def\@eptitle{#2}}

\definecolor{spurple}{HTML}{5e246e}
\definecolor{spurple1}{HTML}{eeddaa}
\definecolor{linkcolor}{HTML}{F75E9B}

\hypersetup{colorlinks=true,allcolors=linkcolor}

\setbeamercolor{palette primary}{fg=spurple,bg=white}
\setbeamercolor{palette secondary} {fg=spurple,bg=white}
\setbeamercolor{structure}{fg=white,bg=spurple}
\setbeamercolor{title in head/foot}{fg=white,bg=spurple}
\setbeamercolor{date in head/foot}{fg=lightgray}
\setbeamercolor{background canvas}{bg=spurple}
\setbeamercolor{title}{fg=blue,bg=spurple}
\setbeamercolor{normal text}{fg=white}
\setbeamercolor{itemize item}{fg=red,bg=spurple}
\setbeamercolor*{item}{fg=red}
\setbeamercolor{title in head/foot}{fg=white,bg=spurple}

\setbeamertemplate{headline}{%
  \leavevmode%
  \hbox{
  \begin{tikzpicture}
    \node[overlay,anchor=south west,inner sep=0,scale=0.4,opacity=0.3] at (10.6cm,-10.15cm) {\includegraphics[width=\textwidth]{serene.png}};
  \end{tikzpicture}
  }
}
% definition of the footline template
\defbeamertemplate*{footline}{mytheme}{%
  \leavevmode%
  \hspace{0.5em}
  \hbox{
    {\usebeamercolor{title in head/foot}{\@ep \- \@eptitle}}}
  \vspace{0.5em}
}

% definition of the title page template
\defbeamertemplate*{title page}{mytheme}[1][]
{%

  \begin{tikzpicture}

    \node[overlay,anchor=south west,inner sep=0,scale=0.6,opacity=1] at (8cm,-7cm) {\includegraphics[width=\textwidth]{serene.png}};

  \end{tikzpicture}

  \begin{tikzpicture}[remember picture,overlay]
    \node[text=white,anchor=south west,font=\sffamily\huge,text width=0.6\paperwidth]
    at ([xshift=20pt,yshift=30pt]current page.west)
    (title)
    {Mathematics of Programming Languages};

    \node[text=white,font=\large\sffamily,anchor=south west]
    at ([xshift=10,yshift=-80pt]title.south west)
    (epnum)
    {Episode \@ep:};
    \node[text=white,font=\large\sffamily,anchor=south west]
    at ([yshift=-15pt]epnum.south west)
    (eptitle)
    {\hspace{0.2cm}\textbf{\@eptitle}};
  \end{tikzpicture}%
}

% remove navigation symbols
\setbeamertemplate{navigation symbols}{}

% definition of the symbols used in itemize
\newcommand\mysymbol{%
  \begin{tikzpicture}[scale=0.1]
    \node[circle,minimum size=2mm,inner sep=0pt, text=white,fill=white] (a) at (0,0){};
  \end{tikzpicture}%
  }

% definition of the itemize templates
\defbeamertemplate*{itemize item}{mysymbol}{\small\raise0.5pt\hbox{\mysymbol}}
\defbeamertemplate*{itemize subitem}{mysymbol}{\footnotesize\raise0.5pt\hbox{\mysymbol}}
\defbeamertemplate*{itemize subsubitem}{mysymbol}{\footnotesize\raise0.5pt\hbox{\mysymbol}}


\newcommand{\pic}[2]{
  \includegraphics[width=#2\textwidth]{#1}}
