\@ifundefined{@base}{\typeout{'fancysection.hva' must be loaded after base style}\endinput}{}
\usepackage{color}
%%% Color section
\def\fcs@hue{}
\newcommand{\colorsections}[1]{
\def\fcs@hue{#1}%
\definecolor{visited}{hsv}{#1,1,.4}
\definecolor{link}{hsv}{#1,1,.7}
\definecolor{hover}{hsv}{#1,.4,1}
\definecolor{title}{hsv}{#1,1,.7}
\definecolor{titlemain}{hsv}{#1,1,.7}
\definecolor{titlerest}{hsv}{#1,1,.7}
\definecolor{part}{hsv}{#1, 1, .8}
\ifthenelse{\equal{\@base}{article}}{%
\definecolor{section}{hsv}{#1, .8, .9}%
\definecolor{subsection}{hsv}{#1, .6, 1}%
\definecolor{subsubsection}{hsv}{#1, .4, 1}%
\definecolor{paragraph}{hsv}{#1, .2, 1}%
}{%
\definecolor{chapter}{hsv}{#1, .8, .9}%
\definecolor{section}{hsv}{#1, .6, 1}%
\definecolor{subsection}{hsv}{#1, .5, 1}%
\definecolor{subsubsection}{hsv}{#1, .4, 1}%
}%
\definecolor{paragraph}{hsv}{#1, .2, 1}}%
\colorsections{120}%
%%
\renewcommand{\@bibtagstyle}{\@span{style="color:\@getstylecolor{visited}"}}%
%% Define sectioning comands
\AtBeginDocument
{\newstyle{body}{background-color:white}%
\newstyle{a:link}
  {color:\@getstylecolor{link};text-decoration:underline;}
\newstyle{a:visited}
  {color:\@getstylecolor{visited};text-decoration:underline;}
\newstyle{a:hover}
  {color:black;text-decoration:none;background-color:\@getstylecolor{hover}}
\newstyle{.title}
  {background-color:\@getstylecolor{title}}%
\newstyle{.titlemain}
  {background-color:\@getstylecolor{titlemain}}%
\newstyle{.titlerest}
  {ackground-color:\@getstylecolor{titlerest}}%
\newstyle{.part}
  {padding:1ex;background-color:\@getstylecolor{part}}%
\newstyle{.section}
  {padding:.5ex;background-color:\@getstylecolor{section}}%
\newstyle{.subsection}
  {padding:0.3ex;background-color:\@getstylecolor{subsection}}%
\newstyle{.subsubsection}
  {padding:0.5ex;background-color:\@getstylecolor{subsubsection}}%
\newstyle{.paragraph}
  {padding:0.5ex;background-color:\@getstylecolor{paragraph}}%
\ifthenelse{\equal{\@base}{book}}
{\newstyle{.chapter}{padding:0.5ex;background-color:\@getstylecolor{chapter}}}
{}%
\newstyle{.fmarginpar}
{border:solid thin \@getstylecolor{subsection}; width:20\%; text-align:left}%
\newstyle{.ffootnoterule}
{border:none;margin:1em auto 1em 0px;width:50\%;background-color:\@getstylecolor{part}}}
\setenvclass{marginpar}{fmarginpar}
\setenvclass{footnoterule}{ffootnoterule}
\newcounter{tocstyle}
\renewenvironment{tocenv}
  {\setenvclass{itemize}{ftoc\thetocstyle}%
   \setenvclass{li-itemize}{\getenvclass{li-toc}}%
   \stepcounter{tocstyle}%
   \begin{itemize}}
  {\end{itemize}\addtocounter{tocstyle}{-1}}
\newcommand{\newftocstyle}[3][0ex]
  {\newstyle{.ftoc#2}{list-style:none;margin:#1 1ex;padding:0ex 1ex;border-left:1ex solid \@getstylecolor{#3}}}
\AtBeginDocument
{\newftocstyle{1}{part}%
\ifthenelse{\equal{\@base}{book}}
{\newftocstyle[1ex]{2}{chapter}\newftocstyle{3}{section}%
 \newftocstyle{4}{subsection}%
 \newftocstyle{5}{subsubsection}%
 \newftocstyle{6}{paragraph}}
{\newftocstyle[1ex]{2}{section}%
 \newftocstyle{3}{subsection}%
 \newftocstyle{4}{subsubsection}%
 \newftocstyle{5}{paragraph}}}
