\RequirePackage{tikz}
\RequirePackage{collcell}

\newcommand{\min@hm@nous}{0}%
\newcommand{\max@hm@nous}{1}%
\newcommand{\min@color@hm@nous}{white}%
\newcommand{\max@color@hm@nous}{red}%
\newcommand{\defualt@d@color@hm@nous}{white}%
\newcommand{\phantom@height@d@color@hm@nous}{\mathstrut}%

\newcommand{\c@color@cell@hm@nous}[2]{%
  \pgfmathsetmacro{\percent@hm@nous}{100.0*(#1-\min@hm@nous)/(\max@hm@nous-\min@hm@nous)}%
    \colorbox{\max@color@hm@nous!\percent@hm@nous!\min@color@hm@nous}{#2}%
}
\newcommand{\c@color@cell@with@value@hm@nous}[1]{%
  \c@color@cell@hm@nous{#1}{#1\vphantom{\phantom@height@d@color@hm@nous}}
}
\newcommand{\c@color@cell@without@value@hm@nous}[1]{%
  \c@color@cell@hm@nous{#1}{}
}

\newcommand{\d@def@color@hm@nous}[2]{%
  \expandafter\def\csname mycolor@for@#1@hm@nous\endcsname{#2}
}

\newcommand{\d@color@hm@nous}[1]{%
  \ifcsname mycolor@for@#1@hm@nous\endcsname\csname mycolor@for@#1@hm@nous\endcsname\else\defualt@d@color@hm@nous\fi%
}

\newcommand{\d@color@cell@hm@nous}[2]{%
  \colorbox{\d@color@hm@nous{#1}}{#2}%
}

\newcommand{\d@color@cell@with@value@hm@nous}[2]{%
  \d@color@cell@hm@nous{#1}{#1\vphantom{\phantom@height@d@color@hm@nous}}%
}
\newcommand{\d@color@cell@with@value@math@hm@nous}[2]{%
  \d@color@cell@hm@nous{#1}{$#1$\vphantom{\phantom@height@d@color@hm@nous}}%
}
\newcommand{\d@color@cell@without@value@hm@nous}[2]{%
  \d@color@cell@hm@nous{#1}{}%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\setDiscreteHeatMapColor}[2]{\d@def@color@hm@nous{#1}{#2}}
\newcommand{\setContinuousHeatMapMax}[1]{\renewcommand{\max@hm@nous}{#1}}
\newcommand{\setContinuousHeatMapMin}[1]{\renewcommand{\min@hm@nous}{#1}}

\newcolumntype{C}{>{\collectcell\c@color@cell@without@value@hm@nous}c<{\endcollectcell}}
\newcolumntype{D}{>{\collectcell\d@color@cell@without@value@hm@nous}c<{\endcollectcell}}
\newcolumntype{V}{>{\collectcell\c@color@cell@with@value@hm@nous}c<{\endcollectcell}}
\newcolumntype{M}{>{\collectcell\d@color@cell@with@value@math@hm@nous}c<{\endcollectcell}}
\newcolumntype{T}{>{\collectcell\d@color@cell@with@value@hm@nous}c<{\endcollectcell}}

