% !TeX spellcheck = en_US
% !TeX encoding = UTF-8
% =============================

\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{tikz-among-us-watermark-eso-pic}[2020-10-23 Custom Package for watermark with eso-pic configurations for AmongUs -- FHZ  -- Version 1.0.1]

\RequirePackage{tikz-among-us}
\RequirePackage{tikz}
\RequirePackage{xifthen}

\RequirePackage{eso-pic}
\RequirePackage{kvoptions}
\SetupKeyvalOptions{
  family=FHZ,
  prefix=FHZ@
}

% -----------------------------------------
% Property cor -- default red
% -----------------------------------------
\DeclareStringOption[red]{cor}

% -----------------------------------------
% Property type -- default 0
% -----------------------------------------
\DeclareStringOption[0]{type}

% -----------------------------------------
% FrontGround (default) BackGround
% -----------------------------------------
\newif\ifFG
\DeclareBoolOption[true]{FG}{%
  \FGtrue
}
\DeclareComplementaryOption{BG}{FG}{%
  \FGfalse
}

\ProcessKeyvalOptions*

% =================================
\newcommand{\FHZ@typeSelection}[1]{
  \ifthenelse{\equal{#1}{0}}
    {\tikz[color=\FHZ@cor!80, opacity=0.4]
      \node{\amongUsOriginal{\FHZ@cor}{white}};}
    {\tikz[color=\FHZ@cor!80, opacity=0.3]
      {\amongUsI{\FHZ@cor}{cyan};}}
}
\newsavebox\myboxAmongUs\savebox\myboxAmongUs{
    \FHZ@typeSelection{\FHZ@type}
}
% =================================

\DeclareOption*{%
  \PackageWarning{FHZ-watermark-eso-pic-amongUs}{Unknown-Desconhecido '\CurrentOption'}
}
\ProcessOptions\relax

% -----------------------------------------
% Apply eso-pic watermark FG or BG
% -----------------------------------------
\ifFHZ@FG
  \AddToShipoutPictureFG{%
    \AtStockLowerLeft{\put(-50,100)
      {\scalebox{3.2}{\rotatebox{30}{\usebox\myboxAmongUs}}}}%
  }
\else
  \AddToShipoutPictureBG{%
    \AtStockLowerLeft{\put(-50,100)
      {\scalebox{3.2}{\rotatebox{30}{\usebox\myboxAmongUs}}}}%
  }
\fi

\endinput