\ProvidesPackage{beamerouterthemeFABstruct}[2017/09/25]

\mode<presentation>

\useinnertheme{rounded}
\ifbeamer@boxed
	\setbeamertemplate{mini frames}[default]
	\setbeamertemplate{sections/subsections in toc}[circle]
	\setbeamertemplate{items}[circle]
\else
	\setbeamertemplate{mini frames}[box]
	\setbeamertemplate{sections/subsections in toc}[square]
	\setbeamertemplate{items}[square]
\fi

\setbeamercolor{kopf}{parent=structure}
\ifbeamer@FABcolour%
	\setbeamercolor*{palette primary}{use=kopf,fg=kopf.bg,bg=kopf.fg!90!white}%
	\setbeamercolor*{palette secondary}{use=kopf,fg=white,bg=kopf.fg!80!black}%
	\setbeamercolor*{palette tertiary}{use=kopf,fg=white,bg=kopf.fg!25!black}%
	\setbeamercolor*{palette quaternary}{fg=white,bg=black}%
	\setbeamercolor{section in head/foot}{parent=palette tertiary}%
\else%
	\setbeamercolor*{palette primary}{use=kopf,fg=white,bg=kopf.fg}%
	\setbeamercolor*{palette secondary}{use=kopf,fg=white,bg=kopf.fg!75!black}%
	\setbeamercolor*{palette tertiary}{use=kopf,fg=white,bg=kopf.fg!25!black}%
	\setbeamercolor*{palette quaternary}{fg=white,bg=black}%
	\setbeamercolor{section in head/foot}{parent=palette quaternary}%
\fi

\setbeamercolor*{titlelike}{parent=palette primary}
\setbeamercolor*{title in head/foot}{parent=palette tertiary}
\setbeamercolor*{author in head/foot}{parent=palette primary}
\setbeamercolor*{institute in head/foot}{parent=palette secondary}
\setbeamercolor*{date in head/foot}{parent=normal text}

\AtBeginDocument{{
 \usebeamerfont*{headline}
 \colorlet{global.bg}{bg}
 \usebeamercolor{subsection in head/foot}
 \usebeamercolor{section in head/foot}
 \usebeamercolor{frametitle}
 \ifbeamer@sb@subsection
  \pgfdeclareverticalshading{beamer@barshade}{\the\paperwidth}{%
   color(0ex)=(global.bg);%
   color(1ex)=(subsection in head/foot.bg);%
   color(3.25ex)=(subsection in head/foot.bg);%
   color(4.25ex)=(section in head/foot.bg);%
   color(9.75ex)=(section in head/foot.bg)%
  }
  \pgfdeclareverticalshading{beamer@aboveframetitle}{\the\paperwidth}{%
   color(0ex)=(frametitle.bg);%
   color(1ex)=(frametitle.bg);%
   color(2ex)=(subsection in head/foot.bg)
  }
 \else
  \pgfdeclareverticalshading{beamer@barshade}{\the\paperwidth}{%
   color(0ex)=(global.bg);%
   color(1ex)=(section in head/foot.bg);%
   color(7ex)=(section in head/foot.bg)%
  }
  \pgfdeclareverticalshading{beamer@aboveframetitle}{\the\paperwidth}{%
   color(0ex)=(frametitle.bg);%
   color(1ex)=(frametitle.bg);%
   color(2ex)=(section in head/foot.bg)
  }
 \fi  
 \pgfdeclareverticalshading{beamer@belowframetitle}{\the\paperwidth}{%
  color(0ex)=(global.bg);%
  color(1ex)=(frametitle.bg)
 }
}}

\defbeamertemplate*{headline}{FABstruct theme}{%
  \pgfuseshading{beamer@barshade}%
  \ifbeamer@sb@subsection%
    \vskip-9.75ex%
    \begin{beamercolorbox}[ignorebg,ht=2.25ex,dp=3.75ex]{section in head/foot}%
    \ifbeamer@Instlogo%
      \insertnavigation{.92\paperwidth}%
      \hfill\raisebox{-.6cm}{\includegraphics[height=0.8cm]{\instlogo}}\hspace*{.2cm}%
    \else%
      \insertnavigation{\paperwidth}%
    \fi%
    \end{beamercolorbox}%
    \begin{beamercolorbox}[ignorebg,ht=2.125ex,dp=1.125ex,%
      leftskip=.3cm,rightskip=.3cm plus1fil]{subsection in head/foot}
      \usebeamerfont{subsection in head/foot}\insertsubsectionhead
    \end{beamercolorbox}%
  \else%
    \vskip-7ex%
    \begin{beamercolorbox}[ignorebg,ht=2.25ex,dp=3.75ex]{section in head/foot}%
    \ifbeamer@Instlogo%
      \insertnavigation{.92\paperwidth}\hspace*{\fill}%
    \else%
      \insertnavigation{\paperwidth}%
    \fi%
    \end{beamercolorbox}%
  \fi}%
\defbeamertemplate*{frametitle}{FABstruct theme}{%
  \nointerlineskip%
  \usebeamerfont{headline}%
  \begin{beamercolorbox}[wd=\paperwidth,ht=1.5ex,dp=0ex,vmode]{empty}
    \pgfuseshading{beamer@aboveframetitle}%
  \end{beamercolorbox}%
  \vskip-.5ex%
  \nointerlineskip%
  \begin{beamercolorbox}[wd=\paperwidth,leftskip=.3cm,rightskip=.3cm plus1fil,vmode]{frametitle}
    \usebeamerfont*{frametitle}\insertframetitle%
    \ifbeamer@sb@subsection{}\else%
      \ifbeamer@Instlogo%
        \hfill\raisebox{1.5mm}[0pt]{\includegraphics[height=0.8cm]{\instlogo}}%
      \fi%
    \fi%
    \ifx\insertframesubtitle\@empty%
        \strut\par%
    \else
        \par{\usebeamerfont*{framesubtitle}{\usebeamercolor[fg]{framesubtitle}\insertframesubtitle}\strut\par}%
    \fi%%
    \usebeamerfont{headline}%
    \vskip.5ex  
  \end{beamercolorbox}%
  \nointerlineskip
  \begin{beamercolorbox}[wd=\paperwidth,ht=.5ex,dp=0ex]{empty}
    \pgfuseshading{beamer@belowframetitle}%
  \end{beamercolorbox}}

% \setbeamerfont{block title}{size={}}
\setbeamerfont*{frametitle}{family=\sffamily, size=\normalsize, series=\bfseries}


\mode<all>
