%%
 % Miun theme for LaTeX Beamer 3.07 or later   2010-05-12
 % Meant to provide a clean Mid Sweden University template
 % Enable with \usetheme{miun2011}
 %
 % Copyright (C) 2010 David Krapohl <david.krapohl@miun.se>
 %
 % Dual-licensed under
 %  1) Creative Commons Attribution-Noncommercial-ShareAlike 3.0 License
 %     http://creativecommons.org/licenses/by-nc-sa/3.0/
 %
 %  2) GNU General Public License 3.0 or later
 %     http://www.fsf.org/licensing/licenses/gpl.html
 %
 % Inspired by previous work by Shawn Lankton:
 % http://www.shawnlankton.com/2008/02/beamer-and-latex-with-keynote-theme/
 %
 % Modified by Daniel Bosk <daniel.bosk@miun.se> in February 2012 to
 % fit the coding and naming conventions in the ver.miun.se repository.
 %%

\RequirePackage{ifpdf}
\newcommand{\@miunbeam@logotype}{CMYK}
\newcommand{\@miunbeam@logofileformat}{eps}
\ifpdf
	\renewcommand{\@miunbeam@logofileformat}{pdf}
\else
	\renewcommand{\@miunbeam@logofileformat}{eps}
\fi

% Default theme as a base
%\RequirePackage{ifxetex}
\usetheme{default}
%\useinnertheme[shadow=true]{}
% we want flat circles instead of bubbles
\setbeamertemplate{sections/subsections in toc}[circle]

%% COLOURS  
% you can use HTML(HEX), RGB(0-255) or cmyk(0.-1.) notation
\definecolor{c1478c7}{RGB}{20,120,199}
\definecolor{cfcd213}{RGB}{252,210,19}
\definecolor{cfddd04}{RGB}{253,221,4}
\definecolor{lightgrey}{RGB}{128,128,128}
\definecolor{miunblue}{RGB}{20,120,199}
%\definecolor{alerthead}{cmyk}{0,1,1,0.25}
%\definecolor{examplehead}{cmyk}{1,0,1,0.63}
\definecolor{examplehead}{cmyk}{0.7,0,1,0}
\definecolor{examplebody}{cmyk}{0.04,0,0.04,0.06}
\definecolor{alerthead}{cmyk}{0,0.94,1,0}


%this is the footer image
%\tikz[remember picture,overlay]{%
%	\node[inner sep=0pt,opacity=1, scale=1, right=-2.6cm, below=-0.77cm]%
%		at (current page.east)  {\input{MU_footer_image.tex}};
%}%
\defbeamertemplate*{title page}{customized}[1][]
{%
	\usebeamerfont{title}{\inserttitle\par}
	\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par
	\vfill
	\usebeamerfont{author}\insertauthor\par
	\usebeamerfont{institute}\insertinstitute\par
	\usebeamerfont{date}\insertdate\par
%	\usebeamercolor[fg]{titlegraphic}\inserttitlegraphic
%	\setbeamercolor*{titlelike}{parent=palette tertiary} 
}

%% Font
\renewcommand\sfdefault{phv}
\usefonttheme[onlymath]{serif}
\renewcommand\familydefault{\sfdefault}
\setbeamerfont{title}{size=\Huge\bfseries}
%\setbeamerfont{frametitle}{size=\huge\bfseries}

\setbeamercolor{title page}{fg=white}
\setbeamercolor{title}{bg=, fg=white}
\setbeamercolor{title in head/foot}{fg=black}
\setbeamercolor{date in head/foot}{fg=black}
\setbeamercolor{author in head/foot}{fg=black}

\setbeamercolor{frametitle}{bg=, fg=miunblue}
\setbeamercolor{normal text}{bg=white, fg=black}


% frametitles
\setbeamertemplate{frametitle}
{%
	\vspace{0.75cm}
	\hspace{-0.25cm}
	%\colorbox{miunblue}{\color{white}{\huge\MakeUppercase{\insertframetitle}}}
	\colorbox{miunblue}{\color{white}{\huge\bfseries\insertframetitle}}\\
	\rotatebox{2.5}{%
		\colorbox{miunblue}{%
			\color{white}{\large\insertframesubtitle}
		}
	}
}

% Structure
%Blocks
\setbeamercolor*{block body}{bg=miunblue!15}
\setbeamercolor*{block body alerted}{bg=red!10}
\setbeamercolor*{block body example}{bg=examplebody}
\setbeamercolor*{block title}{fg=white,bg=miunblue}
\setbeamercolor*{block title alerted}{fg=white,bg=alerthead}
\setbeamercolor*{block title example}{fg=white,bg=examplehead}

% Items
\setbeamertemplate{items}[square]
\setbeamertemplate{subitems}[square]
%\setbeamertemplate{itemize subitem} % Beamer-Template/-Color/-Font 
% \setbeamertemplate{itemize subsubitem} % Beamer-Template/-Color/-Font 
\setbeamercolor{structure}{fg=black}
\setbeamercolor{item}{fg=miunblue}
\setbeamercolor{itemize item}{fg=black}
\setbeamercolor{itemize subitem}{fg=black}
\setbeamercolor{itemize subsubitem}{fg=black}

% Features
% declare the university image: can be used with “university-logo”
\pgfdeclareimage[height=0.5cm]{logo}
	{MU_logotyp_int_\@miunbeam@logotype.\@miunbeam@logofileformat}
\pgfdeclareimage[height=2cm]{large_logo}
	{MU_logotyp_int_\@miunbeam@logotype.\@miunbeam@logofileformat}
\setbeamertemplate{headline}{}
\setbeamertemplate{navigation symbols}{}
\logo{\pgfuseimage{logo}}

%fill the footer
\setbeamertemplate{footline}{%
	\hbox{%
		\begin{beamercolorbox}[wd=.33\paperwidth,ht=2.25ex,dp=0.75ex,left]
			{author in head/foot}%
			\usebeamerfont{author in head/foot}\hspace*{2ex}\insertauthor
		\end{beamercolorbox}%
		\begin{beamercolorbox}[wd=.33\paperwidth,ht=2.25ex,dp=0.75ex,center]
			{title in head/foot}%
			\usebeamerfont{title in head/foot}\insertshorttitle
		\end{beamercolorbox}%
		\begin{beamercolorbox}[wd=.33\paperwidth,ht=2.25ex,dp=0.75ex,right]
			{date in head/foot}%
			\usebeamerfont{date in head/foot}
			\insertframenumber{} / \inserttotalframenumber\hspace*{2ex} 
		\end{beamercolorbox}%
	}%
	\vskip0pt%	 
}

% can be used to create smaller blocks
\newenvironment<>{varblock}[2][\textwidth]{%
	\setlength{\textwidth}{#1}
	\begin{actionenv}#3%
		\def\insertblocktitle{#2}%
		\par%
		\usebeamertemplate{block begin}%
}{%
		\par%
		\usebeamertemplate{block end}%
	\end{actionenv}%
}
