\ProvidesPackage{beamerthemeconfposter}
\RequirePackage{tikz}		% for drawing the nice rounded boxes
\usetikzlibrary{arrows,backgrounds}
\newcommand{\makeruleinbox}{{\usebeamercolor[bg]{block alerted title}\centering\hspace*{-0.7cm}\rule{\inboxrule}{0.5cm}}}
\usepackage{ragged2e}

% Spacing before and inside list environments to add white space before lists and between items inside lists
\makeatletter
\def\@listi{\leftmargin\leftmarginii
\topsep 1ex % Spacing before lists
\parsep 0\p@ \@plus\p@
\itemsep 6pt} % Spacing between items
\makeatother

\usecaptiontemplate{\small\structure{\insertcaptionname~\insertcaptionnumber: }\insertcaption} % A fix for figure numbering

\definecolor{lgreen} {RGB}{180,210,100}
\definecolor{dblue}  {RGB}{41,40,64}
\definecolor{ddblue} {RGB}{11,36,69}
\definecolor{lred}   {RGB}{220,0,0}
\definecolor{nred}   {RGB}{224,0,0}
\definecolor{norange}{RGB}{230,120,20}
\definecolor{nyellow}{RGB}{255,221,0}
\definecolor{ngreen} {RGB}{98,158,31}
\definecolor{dgreen} {RGB}{78,138,21}
\definecolor{nblue}  {RGB}{28,130,185}
\definecolor{jblue}  {RGB}{20,50,100}

% set the basic colors
\setbeamercolor{palette primary}   {fg=black,bg=white}
\setbeamercolor{palette secondary} {fg=black,bg=white}
\setbeamercolor{palette tertiary}  {bg=jblue,fg=white}
\setbeamercolor{palette quaternary}{fg=black,bg=white}
\setbeamercolor{structure}{fg=jblue}
\setbeamercolor{titlelike}         {bg=jblue,fg=white}
\setbeamercolor{frametitle}        {bg=jblue!10,fg=jblue}
\setbeamercolor{cboxb}{fg=black,bg=dblue}
\setbeamercolor{cboxr}{fg=black,bg=red}

% set colors for itemize/enumerate
\setbeamercolor{item}{fg=dblue}
\setbeamercolor{item projected}{fg=white,bg=ngreen}

% set colors for blocks
\setbeamercolor{block title}{fg=dblue,bg=white}
\setbeamercolor{headline}{fg=white,bg=dblue}
\setbeamercolor{block body}{fg=black,bg=white}

% set colors for alerted blocks (blocks with frame)
\setbeamercolor{block alerted title}{fg=white,bg=jblue}
\setbeamercolor{block alerted body}{fg=black,bg=jblue!10}

% set the fonts
\setbeamerfont{section in head/foot}{series=\bfseries}
\setbeamerfont{block title}{series=\bfseries}
\setbeamerfont{block alerted title}{series=\bfseries}
\setbeamerfont{frametitle}{series=\bfseries}
\setbeamerfont{frametitle}{size=\Large}
\setbeamerfont{block body}{size=\normalsize}

% set some beamer theme options
\setbeamertemplate{title page}[default][colsep=-4bp,rounded=true]
\setbeamertemplate{sections/subsections in toc}[square]
\setbeamertemplate{blocks}[width=0.0]
\beamertemplatenavigationsymbolsempty

% set bibliography style
\setbeamertemplate{bibliography item}[text]
\setbeamercolor{bibliography item}{fg=black,bg=white}
\setbeamercolor{bibliography entry author}{fg=black,bg=white}
\setbeamercolor{bibliography item}{fg=black,bg=white}

% define some length variables that are used by the template
\newlength{\inboxwd}
\newlength{\iinboxwd}
\newlength{\inboxrule}
\makeatletter
\makeatother

%==============================================================================
% build the poster title
%==============================================================================
\setbeamertemplate{headline}{
 \begin{beamercolorbox}{headline}
     \vspace{1cm}
 \begin{columns}[T]
     \begin{column}[T]{0.88\paperwidth}
         \begin{center}
       \usebeamercolor{title in headline}{\LARGE{\textbf{\inserttitle}}}

   \vspace{0.5cm}

       \usebeamercolor{author in headline}{\Large{\insertauthor}}
   \end{center}
   \vspace{0.2cm}
   \end{column}
     \begin{column}[T]{0.12\linewidth}
         \vspace{0.3cm}
         \includegraphics{qr2.png}

     \end{column}
  \end{columns}
  \vspace{1cm}
 \end{beamercolorbox}
}

\setbeamertemplate{footline}{
 \begin{beamercolorbox}[colsep=0.08cm]{cboxb}\end{beamercolorbox}
  
     \begin{columns}
         \begin{column}{0.70\paperwidth}
       \begin{center}
           \usebeamercolor{institute in headline}{\color{fg}\large{\insertinstitute}}
       \end{center}
       \vspace{0.1cm}
   \end{column}
   \begin{column}{0.30\paperwidth}
       \normalsize{Contact: \texttt{thibaut.horel@gmail.com}}
    \end{column}
  \end{columns}
}

% Block definition
\setbeamertemplate{block begin}
{
  \par\vskip\medskipamount
  \begin{beamercolorbox}[colsep*=0ex,dp={2ex},center]{block title}
    \vskip-0.25cm
    \usebeamerfont{block title}\large\insertblocktitle
    \begin{flushleft}
    \vskip-1cm
    \begin{tikzpicture}[remember picture,overlay]
      \shade [inner color=gray,outer color=white]
      (0,0) rectangle (\textwidth,0.3cm);
    \end{tikzpicture}
    \end{flushleft}
  \end{beamercolorbox}
  {\parskip0pt\par}
  \ifbeamercolorempty[bg]{block title}
  {}
  {\ifbeamercolorempty[bg]{block body}{}{\nointerlineskip\vskip-0.5pt}}
  \usebeamerfont{block body}
  \vskip-0.5cm
  \begin{beamercolorbox}[colsep*=0ex,vmode]{block body}
  \justifying
}

\setbeamertemplate{block end}
{
  \end{beamercolorbox}
  \vskip\smallskipamount
}

% Alert block definition (with frame)
\setbeamertemplate{block alerted begin}
{
  \par\vskip\medskipamount
  \begin{beamercolorbox}[sep=0ex,rounded=true,center,dp={2ex}]{block alerted title}
    \vskip0.01cm
    \usebeamerfont{block title}\large\insertblocktitle
  \end{beamercolorbox}
  {\parskip0pt\par}
  \usebeamerfont{block body}
  \vskip-0.8cm
  \begin{beamercolorbox}[sep=0.5cm, rounded=true,center]{block alerted title}
  \setlength{\inboxwd}{\linewidth}
  \addtolength{\inboxwd}{-1cm}
  \begin{beamercolorbox}[rounded=true,wd={\inboxwd},center]{block alerted body}
  \setlength{\iinboxwd}{\inboxwd}
  \setlength{\inboxrule}{\inboxwd}
  \addtolength{\iinboxwd}{-0.5cm}
  \addtolength{\inboxrule}{0.5cm}
  \begin{center}
  \begin{minipage}{\iinboxwd}
  \justifying
}

\setbeamertemplate{block alerted end}
{
  \end{minipage}
  \end{center}
  \end{beamercolorbox}
  \end{beamercolorbox}
  \vskip\smallskipamount
}
