%
% Latex-Beamer theme CleanGreen
%
% Author: André Conrad
% Date: 2023-02-23
% Version: 0.1
%


\mode<presentation>


% ---------------------------------------
%% Loading packages
% ---------------------------------------
\RequirePackage{tikz}
\usetikzlibrary{%
  mindmap,
  trees
}

\RequirePackage{csquotes}



%Define a reference depth. 
%You can choose either relative or absolute.
%--------------------------
\newlength{\DepthReference}
%\settodepth{\DepthReference}{g}%relative to a depth of a letter.
\setlength{\DepthReference}{2pt}%absolute value.

%Define a reference Height. 
%You can choose either relative or absolute.
%--------------------------
\newlength{\HeightReference}
%\settoheight{\HeightReference}{T}
\setlength{\HeightReference}{6pt}

%--------------------------
\newlength{\Width}%
\newcommand{\navbox}[2][red]%
{%
    \settowidth{\Width}{#2}%
    %\setlength{\fboxsep}{0pt}%
    \colorbox{#1}%
    {%      
        \raisebox{-\DepthReference}%
        {%
            \parbox[b][\HeightReference+\DepthReference][c]{\Width}{\centering#2}%
        }%
    }%
}
\setlength{\fboxsep}{1pt}


% ---------------------------------------
%% Colors
% ---------------------------------------
\definecolor{gray20}{HTML}{CCCCCC}
\definecolor{gray70}{HTML}{4C4C4C}

\definecolor{green1}{HTML}{A0DDCE}
\definecolor{green2}{HTML}{E9F8F3}

\definecolor{blue1}{HTML}{0070C0}
\definecolor{blue2}{HTML}{004C97}

\definecolor{lightbrown1}{HTML}{E3DBD3}
\definecolor{brown1}{HTML}{AD8f67}


\definecolor{webgreen}{rgb}{0,.5,0}
\definecolor{webbrown}{rgb}{.6,0,0}

\definecolor{gray1}{rgb}{.92,.92,.92}
\definecolor{gray2}{rgb}{.85,.85,.85}
\definecolor{gray50}{rgb}{.5,.5,.5}

\definecolor{applegreen}{rgb}{0.55, 0.71, 0.0}
\definecolor{brickred}{rgb}{0.8, 0.25, 0.33}
\definecolor{darklavender}{rgb}{0.45, 0.31, 0.59}
\definecolor{charcoal}{rgb}{0.21, 0.27, 0.31}

% Title slide
\setbeamercolor*{title page header}{fg=gray70}
\setbeamercolor*{author}{fg=gray70}
\setbeamercolor*{date}{fg=gray70}

% Framtitle
\setbeamercolor*{frametitle}{fg=gray70,bg=white}

% Footer
\setbeamercolor{footline}{fg=gray70,bg=white}

% List items
\setbeamercolor*{item}{fg=black}
\setbeamercolor*{enumerate item}{fg=black}

% Blocks
\setbeamercolor{block title}{fg=blue1}
%\setbeamercolor{block body}{bg=green2}

% Caption
\setbeamercolor{caption name}{fg=blue1}
\setbeamercolor{caption}{fg=gray70}

% Table of Content
\setbeamercolor{section in toc}{fg=blue1}
\setbeamercolor{subsection in toc}{fg=blue1}

% Bibliography
\setbeamercolor*{bibliography item}{fg=black}
\setbeamercolor*{bibliography entry title}{fg=blue2}
\setbeamercolor*{bibliography entry author}{fg=black}
\setbeamercolor*{bibliography entry location}{fg=black}
\setbeamercolor*{bibliography entry note}{fg=black}


% ---------------------------------------
%% Font Size
% ---------------------------------------

\setbeamerfont{frametitle}{size=\huge}
\setbeamerfont{framesubtitle}{size=\normalsize}

\setbeamerfont{title}{size=\huge}
\setbeamerfont{subtitle}{size=\normalsize}
\setbeamerfont*{author}{size=\normalsize}
\setbeamerfont*{date}{size=\small}
\setbeamerfont*{frametitle}{size=\huge}
\setbeamerfont*{footline}{size=\tiny}
\setbeamerfont*{institute}{size=\footnotesize}

%\setbeamerfont{itemize/enumerate body}{size=\Large}
%\setbeamerfont{itemize/enumerate subbody}{size=\Large}
%\setbeamerfont{itemize/enumerate subsubbody}{size=\large}
\setbeamerfont{enumerate item}{series=\bfseries}
\setbeamerfont{description item}{series=\bfseries}

\setbeamerfont{caption}{size=\tiny}

% Table of Content
\setbeamerfont{section in toc}{size=\normalsize}
\setbeamerfont{subsection in toc}{size=\normalsize}

\setbeamerfont{section number projected}{%
  family=\rmfamily,series=\bfseries,size=\normalsize}
\setbeamercolor{section number projected}{bg=green1,fg=black}

% ball, circle and square
\setbeamertemplate{sections/subsections in toc}[circle]


% ---------------------------------------
%% Frame (inner/outer)
% ---------------------------------------

\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{caption}[numbered]

\setbeamertemplate{enumerate item}{\textbf{\arabic{enumi}.}}
\setbeamertemplate{enumerate subitem}{\textbf{\arabic{enumii}.}}

\setbeamersize{text margin left=16pt,text margin right=16pt}


% -----------------------
%% Title Page
% -----------------------
\defbeamertemplate*{title page}{cleangreen}
{
    \centering
   
    \vskip 1cm%
   
    \begin{beamercolorbox}[center,sep=8pt]{title page header}
      \usebeamerfont{title}\textbf{\inserttitle}\par%
      \vskip 0.25cm%
      \usebeamerfont{subtitle}\insertsubtitle
    \end{beamercolorbox}%
    
    \textcolor{green1}{\rule{.96\textwidth}{1.5pt}}
    
    \vskip 0.75cm%
    
    \begin{beamercolorbox}[center]{author}
      \usebeamerfont{author}\insertauthor\\[2ex]
      \usebeamerfont{institute}\insertinstitute\\[5ex]
      \usebeamerfont{date}\insertdate
    \end{beamercolorbox}
}


% -----------------------
%% Definition - Horizontal Nav Bar
% -----------------------

\setbeamertemplate{section in head/foot}{%
    %\colorbox{green2}{\strut\bfseries\insertsectionhead}
    \navbox[green2]{\bfseries\insertsectionhead}
}

\setbeamertemplate{section in head/foot shaded}{%
    %\color{gray2}\insertsectionhead
    \navbox[white]{\bfseries\color{gray2}\insertsectionhead}
}
      

% -----------------------
%% Frametitle
% -----------------------
\defbeamertemplate*{frametitle}{cleangreen}
{
  \begin{beamercolorbox}[left, ht=36pt, wd=\paperwidth, leftskip=16pt, rightskip=16pt]{frametitle}
    \ifx\insertframesubtitle\@empty%
      \begin{tikzpicture}
        \draw (0,0) -- (\textwidth,0) [line width=1pt, green2];
        \draw (0,4pt) node [anchor=south west,inner sep=0mm, text depth=1mm] {\usebeamerfont{frametitle}\insertframetitle};
      \end{tikzpicture}
    \else%
      \begin{tikzpicture}
        \draw (0,0) -- (\textwidth,0) [line width=1pt, green2];
        \draw (0,1pt) node [anchor=south west,inner sep=0mm, text depth=1mm] {\small\insertframesubtitle};
        \draw (0,13pt) node [anchor=south west,inner sep=0mm, text depth=1mm] {\Large\insertframetitle};
      \end{tikzpicture}
    \fi
    \ifx\showHorizontalNavBar\empty%
      \vspace*{-18pt}
    \else
      \hspace*{-13.24pt}
      \footnotesize
      \insertnavigation{\textwidth}
    \fi
  \end{beamercolorbox}
}


% -----------------------
%% Footline
% -----------------------
\newcommand{\footlinetext}[1]{\def\insertfootlinetext{#1}}

\defbeamertemplate*{footline}{cleangreen}
{
  \begin{beamercolorbox}[left, ht=20pt, wd=\textwidth, leftskip=16pt, rightskip=16pt]{footline}%
    \usebeamerfont{footline}
    \ifx\insertframetitle\@empty%
        %\hfill\insertpagenumber\vspace{2.75mm}
        \raggedleft\insertframenumber~/~\inserttotalframenumber\hspace{12.25pt}\vspace{8pt}
    \else%
      \begin{tikzpicture}
        \draw (0,0) -- (423pt,0) [line width=1pt, green2];
        \draw (-3pt,0) node [anchor=north west, inner sep=3pt] {\includegraphics[height=14pt]{gfx/fernuni_hagen_logo.jpg}};
        \draw (100pt,-8pt) node [anchor=north west, inner sep=0mm, text depth=1mm] {\insertfootlinetext};
        \draw (423pt,-8pt) node [anchor=north east,inner sep=0mm, text depth=1mm] {\insertframenumber~/~\inserttotalframenumber};
     \end{tikzpicture}
    \fi
  \end{beamercolorbox}
}

\mode<all>

