%%
%% This is file `hycolor.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% hycolor.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Project: hycolor
%% Version: 2020-01-27 v1.10
%% 
%% Copyright (C)
%%    2007-2011 Heiko Oberdiek
%%    2016-2020 Oberdiek Package Support Group
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3c of this license or (at your option) any later
%% version. This version of this license is in
%%    https://www.latex-project.org/lppl/lppl-1-3c.txt
%% and the latest version of this license is in
%%    https://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
%% 
%% This work has the LPPL maintenance status "maintained".
%% 
%% The Current Maintainers of this work are
%% Heiko Oberdiek and the Oberdiek Package Support Group
%% https://github.com/ho-tex/hycolor/issues
%% 
%% This work consists of the main source file hycolor.dtx
%% and the derived files
%%    hycolor.sty, hycolor.pdf, hycolor.ins, hycolor.drv,
%%    xcolor-patch.sty
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{hycolor}%
  [2020-01-27 v1.10 Color options for hyperref/bookmark (HO)]%
\AtBeginDocument{%
\def\@tempa#1,{%
    \XC@ifxcase\tm{%
      \XC@mod@rgb{%
        \XC@calcN{#1}\@@tmp
        \edef\@@tmp{\@@tmp,\@@tmp,\@@tmp}%
      }%
      \XC@mod@cmy{%
        \XC@calcC{#1}\@@tmp
        \edef\@@tmp{\@@tmp,\@@tmp,\@@tmp}%
      }%
      \XC@mod@cmyk{%
        \XC@calcC{#1}\@@tmp
        \edef\@@tmp{0,0,0,\@@tmp}%
      }%
      \XC@mod@RGB{%
        \edef\@@scl{\rangeRGB}%
        \XC@calcM{#1}\@@tmp
        \edef\@@tmp{\@@tmp,\@@tmp,\@@tmp}%
      }%
      \XC@mod@HTML{%
        \edef\@@scl{\@cclv}%
        \XC@calcM{#1}\@@tmp
        \XC@calcH\@@tmp\@@tmp
        \edef\@@tmp{\@@tmp\@@tmp\@@tmp}%
      }%
      \XC@mod@HSB{%
        \edef\@@scl{\rangeHSB}%
        \XC@calcM{#1}\@@tmp
        \edef\@@tmp{0,0,\@@tmp}%
      }%
      \XC@mod@Gray{%
        \edef\@@scl{\rangeGray}%
        \XC@calcM{#1}\@@tmp
      }%
    }%
    {%
      \XC@calcN{#1}\@@tmp
      \edef\@@tmp{0,0,\@@tmp}%
    }%
  }%
\ifx\XC@cnv@gray\@tempa
    \def\XC@cnv@gray#1,{%
      \XC@ifxcase\tm{%
        \XC@mod@rgb{%
          \XC@calcN{#1}\@@tmp
          \edef\@@tmp{\@@tmp,\@@tmp,\@@tmp}%
        }%
        \XC@mod@gray{}%
        \XC@mod@cmy{%
          \XC@calcC{#1}\@@tmp
          \edef\@@tmp{\@@tmp,\@@tmp,\@@tmp}%
        }%
        \XC@mod@cmyk{%
          \XC@calcC{#1}\@@tmp
          \edef\@@tmp{0,0,0,\@@tmp}%
        }%
        \XC@mod@RGB{%
          \edef\@@scl{\rangeRGB}%
          \XC@calcM{#1}\@@tmp
          \edef\@@tmp{\@@tmp,\@@tmp,\@@tmp}%
        }%
        \XC@mod@HTML{%
          \edef\@@scl{\@cclv}%
          \XC@calcM{#1}\@@tmp
          \XC@calcH\@@tmp\@@tmp
          \edef\@@tmp{\@@tmp\@@tmp\@@tmp}%
        }%
        \XC@mod@HSB{%
          \edef\@@scl{\rangeHSB}%
          \XC@calcM{#1}\@@tmp
          \edef\@@tmp{0,0,\@@tmp}%
        }%
        \XC@mod@Gray{%
          \edef\@@scl{\rangeGray}%
          \XC@calcM{#1}\@@tmp
        }%
      }%
      {%
        \XC@calcN{#1}\@@tmp
        \edef\@@tmp{0,0,\@@tmp}%
      }%
    }%
\fi
\let\@tempa\relax
}
\begingroup
  \catcode`\!=13 %
  \catcode`\:=13 %
  \catcode`\-=13 %
  \catcode`\+=13 %
  \catcode`\;=13 %
  \catcode`\"=13 %
  \catcode`\>=13 %
  \edef\x{%
    \def\noexpand!{\string!}%
    \def\noexpand:{\string:}%
    \def\noexpand-{\string-}%
    \def\noexpand+{\string+}%
    \def\noexpand;{\string;}%
    \def\noexpand"{\string"}%
    \def\noexpand>{\string>}%
  }%
  \def\y#1{\endgroup
    \def\HyColor@DefSanitized##1##2{%
      \begingroup
        \csname @safe@activestrue\endcsname
        #1%
        \edef\x{\endgroup
          \def\noexpand##1{##2}%
        }%
      \x
      \@onelevel@sanitize##1%
    }%
  }%
\expandafter\y\expandafter{\x}
\def\HyColor@NormalizeNum#1#2{%
  \ifdim#1pt<\z@
    \def#2{0}%
  \else
    \edef#2{\zap@space#1 \@empty}%
    \expandafter\HyColor@CheckDot#2..\@nil#2%
  \fi
}
\def\HyColor@CheckDot#1.#2.#3\@nil#4{%
  \ifnum0#1<\@ne
    \ifx\\#2\\%
      \def#4{0}%
    \else
      \edef#4{\HyColor@ReverseString#2\@nil{}}%
      \edef#4{\expandafter\HyColor@StripLeadingZeros#4\@empty}%
      \ifx#4\@empty
        \def#4{0}%
      \else
        \edef#4{.\expandafter\HyColor@ReverseString#4\@nil{}}%
      \fi
    \fi
  \else
    \def#4{1}%
  \fi
}
\def\HyColor@ReverseString#1#2\@nil#3{%
  \ifx\\#2\\%
    #1#3%
  \else
    \@ReturnAfterFi{%
      \HyColor@ReverseString#2\@nil{#1#3}%
    }%
  \fi
}
\long\def\@ReturnAfterFi#1\fi{\fi#1}
\def\HyColor@StripLeadingZeros#1{%
  \ifx#10%
    \expandafter\HyColor@StripLeadingZeros
  \else
    #1%
  \fi
}
\def\HyColor@NormalizeCommaRGB#1,#2,#3\@nil#4{%
  \HyColor@NormalizeNum{#1}\HyColor@temp
  \let#4\HyColor@temp
  \HyColor@NormalizeNum{#2}\HyColor@temp
  \edef#4{#4 \HyColor@temp}%
  \HyColor@NormalizeNum{#3}\HyColor@temp
  \edef#4{#4 \HyColor@temp}%
}
\def\HyColor@NormalizeCommaCMYK#1,#2,#3,#4\@nil#5{%
  \HyColor@NormalizeNum{#1}\HyColor@temp
  \let#5\HyColor@temp
  \HyColor@NormalizeNum{#2}\HyColor@temp
  \edef#5{#5 \HyColor@temp}%
  \HyColor@NormalizeNum{#3}\HyColor@temp
  \edef#5{#5 \HyColor@temp}%
  \HyColor@NormalizeNum{#4}\HyColor@temp
  \edef#5{#5 \HyColor@temp}%
}
\def\HyColor@BookmarkColor#1#2#3#4{%
  \HyColor@IfModel{#1}{%
    \HyColor@IfXcolor{%
      \convertcolorspec\HyColor@model\HyColor@values
                       \HyColor@model@rgb#2%
      \expandafter\HyColor@NormalizeCommaRGB#2\@nil#2%
    }{%
      \ifx\HyColor@model\HyColor@model@rgb
        \expandafter\HyColor@NormalizeCommaRGB\HyColor@values\@nil#2%
      \else
        \ifx\HyColor@model\HyColor@model@gray
          \expandafter\HyColor@NormalizeNum
              \expandafter{\HyColor@values}#2%
          \edef#2{#2 #2 #2}%
        \else
          \let#2\@empty
          \HyColor@ErrorModelNoXcolor{#3}{#4}%
        \fi
      \fi
    }%
  }{%
    \let#2\HyColor@values
    \ifx#2\@empty
    \else
      \HyColor@IfXcolor{%
        \extractcolorspec{#1}#2%
        \expandafter\convertcolorspec#2\HyColor@model@rgb#2%
        \expandafter\HyColor@NormalizeCommaRGB#2\@nil#2%
      }{%
        \let#2\@empty
        \HyColor@ErrorSpecNoXcolor{#3}{#4}%
      }%
    \fi
  }%
}
\def\HyColor@ErrorModelNoXcolor#1#2{%
  \PackageError{#1}{%
    Color model `\HyColor@model' is not supported\MessageBreak
    without package `xcolor' in\MessageBreak
    `#2=[\HyColor@model]{\HyColor@values}'%
  }\@ehc
}
\def\HyColor@ErrorSpecNoXcolor#1#2{%
  \PackageError{#1}{%
    This color specification is not supported\MessageBreak
    without package `xcolor' in\MessageBreak
    `#2=\HyColor@values'%
  }\@ehc
}
\def\HyColor@IfModel#1{%
  \@ifnextchar[{%
    \HyColor@WithModel
  }{%
    \HyColor@WithoutModel
  }%
  #1\@nil
}
\def\HyColor@WithModel[#1]#2\@nil{%
  \HyColor@DefSanitized\HyColor@model{#1}%
  \HyColor@DefSanitized\HyColor@values{#2}%
  \@firstoftwo
}
\def\HyColor@WithoutModel#1\@nil{%
  \let\HyColor@model\relax
  \HyColor@DefSanitized\HyColor@values{#1}%
  \@secondoftwo
}
\long\def\@ReturnAfterFi#1\fi{\fi#1}
\def\HyColor@IfXcolor{%
  \begingroup\expandafter\expandafter\expandafter\endgroup
  \expandafter\ifx\csname convertcolorspec\endcsname\relax
    \expandafter\@secondoftwo
  \else
    \expandafter\@firstoftwo
  \fi
}
\def\HyColor@model@empty{empty}
\@onelevel@sanitize\HyColor@model@empty
\def\HyColor@model@gray{gray}
\@onelevel@sanitize\HyColor@model@gray
\def\HyColor@model@rgb{rgb}
\@onelevel@sanitize\HyColor@model@rgb
\def\HyColor@model@cmyk{cmyk}
\@onelevel@sanitize\HyColor@model@cmyk
\def\HyColor@model@Gray{Gray}
\@onelevel@sanitize\HyColor@model@Gray
\def\HyColor@UseColor#1{%
  \ifx\relax#1\@empty
  \else
    \ifx\@empty#1\@empty
    \else
      \expandafter\expandafter\expandafter\HyColor@@UseColor#1\@nil
    \fi
  \fi
}
\def\HyColor@@UseColor{%
  \@ifnextchar[\HyColor@@@UseColor\HyColor@@@@UseColor
}
\def\HyColor@@@UseColor[#1]#2\@nil{%
  \color[{#1}]{#2}%
}
\def\HyColor@@@@UseColor#1\@nil{%
  \color{#1}%
}
\def\HyColor@HyperrefColor#1#2{%
  \HyColor@IfModel{#1}{%
    \edef#2{[{\HyColor@model}]{\HyColor@values}}%
  }{%
    \let#2\HyColor@values
    \ifx#2\@empty
      \let#2\relax
    \fi
  }%
}
\def\HyColor@XZeroOneThreeFour#1#2#3#4{%
  \HyColor@IfModel{#1}{%
    \ifx\HyColor@model\HyColor@model@empty
      \let#2\@empty
    \else\ifx\HyColor@model\HyColor@model@gray
      \expandafter\HyColor@NormalizeNum
          \expandafter{\HyColor@values}#2%
    \else\ifx\HyColor@model\HyColor@model@rgb
      \expandafter\HyColor@NormalizeCommaRGB\HyColor@values\@nil#2%
    \else\ifx\HyColor@model\HyColor@model@cmyk
      \expandafter\HyColor@NormalizeCommaCMYK\HyColor@values\@nil#2%
    \else\ifx\HyColor@model\HyColor@model@Gray
      \HyColor@IfXcolor{%
        \convertcolorspec\HyColor@model\HyColor@values
                         \HyColor@model@gray#2%
        \expandafter\HyColor@NormalizeNum\expandafter{#2}#2%
        \let\HyColor@model\HyColor@model@gray
      }{%
        \let#2\relax
        \HyColor@ErrorModelNoXcolor{#3}{#4}%
      }%
    \else
      \HyColor@IfXcolor{%
        \convertcolorspec\HyColor@model\HyColor@values
                         \HyColor@model@rgb#2%
        \expandafter\HyColor@NormalizeCommaRGB#2\@nil#2%
        \let\HyColor@model\HyColor@model@rgb
      }{%
        \let#2\relax
        \HyColor@ErrorModelNoXcolor{#3}{#4}%
      }%
    \fi\fi\fi\fi\fi
  }{%
    \let#2\HyColor@values
    \ifx#2\@empty
      \let#2\relax
    \else
      \expandafter\HyColor@IfRGB\expandafter{\HyColor@values}{%
        \expandafter\HyColor@NormalizeCommaRGB\HyColor@values\@nil#2%
      }{%
        \HyColor@IfXcolor{%
          \expandafter\extractcolorspec\expandafter{\HyColor@values}#2%
          \edef\HyColor@model{\expandafter\@firstoftwo#2}%
          \edef\HyColor@values{\expandafter\@secondoftwo#2}%
          \ifx\HyColor@model\HyColor@model@gray
            \expandafter\HyColor@NormalizeNum\expandafter
                {\HyColor@values}#2%
          \else\ifx\HyColor@model\HyColor@model@rgb
            \expandafter\HyColor@NormalizeCommaRGB
                \HyColor@values\@nil#2%
          \else\ifx\HyColor@model\HyColor@model@cmyk
            \expandafter\HyColor@NormalizeCommaCMYK
                \HyColor@values\@nil#2%
          \else\ifx\HyColor@model\HyColor@model@Gray
            \convertcolorspec\HyColor@model\HyColor@values
                \HyColor@model@gray#2%
            \expandafter\HyColor@NormalizeNum\expandafter
                {\HyColor@values}#2%
            \let\HyColor@model\HyColor@model@gray
          \else
            \convertcolorspec\HyColor@model\HyColor@values
                \HyColor@model@rgb#2%
            \expandafter\HyColor@NormalizeCommaRGB#2\@nil#2%
            \let\HyColor@model\HyColor@model@rgb
          \fi\fi\fi\fi
        }{%
          \let#2\relax
          \HyColor@ErrorSpecNoXcolor{#3}{#4}%
        }%
      }%
    \fi
  }%
}
\let\HyColor@FieldBColor\HyColor@XZeroOneThreeFour
\def\HyColor@FieldColor#1#2#3#4{%
  \let\HyColor@model\@empty
  \HyColor@XZeroOneThreeFour{#1}{#2}{#3}{#4}%
  \ifx#2\relax
    \let#2\@empty
  \else
    \ifx#2\@empty
    \else
      \ifx\HyColor@model\HyColor@model@gray
        \edef#2{#2 g}%
      \else\ifx\HyColor@model\HyColor@model@rgb
        \edef#2{#2 rg}%
      \else\ifx\HyColor@model\HyColor@model@cmyk
        \edef#2{#2 k}%
      \else
        \PackageError{#3}{Internal error: unsupported color model}\@ehc
      \fi\fi\fi
    \fi
  \fi
}
\newif\ifHyColor@result
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname pdfmatch\endcsname\relax
  \expandafter\@firstoftwo
\else
  \expandafter\@secondoftwo
\fi
{%
  \begingroup
    \def\x#1{\endgroup
      \def\HyColor@IfRGB##1{%
        \HyColor@@IfRGB##1#1#1#1\@nil
      }%
    }%
  \x{ }%
  \edef\HyColor@TwoSpaces{\space\space}%
  \def\HyColor@@IfRGB#1 #2 #3 #4\@nil{%
    \HyColor@resulttrue
    \def\HyColor@temp{#4}%
    \ifx\HyColor@temp\HyColor@TwoSpaces
      \HyColor@CheckNum{#1}%
      \ifHyColor@result
        \HyColor@CheckNum{#2}%
        \ifHyColor@result
          \HyColor@CheckNum{#3}%
        \fi
      \fi
    \else
      \HyColor@resultfalse
    \fi
    \ifHyColor@result
      \let\HyColor@model\HyColor@model@rgb
      \edef\HyColor@values{#1,#2,#3}%
      \expandafter\@firstoftwo
    \else
      \expandafter\@secondoftwo
    \fi
  }%
  \def\HyColor@zero{0}%
  \def\HyColor@one{1}%
  \def\HyColor@dot{.}%
  \def\HyColor@CheckNum#1{%
    \def\HyColor@temp{#1}%
    \ifx\HyColor@temp\@empty
      \HyColor@resultfalse
    \else
      \edef\HyColor@temp{\@car#1\@nil}%
      \ifx\HyColor@temp\HyColor@zero
      \else
        \ifx\HyColor@temp\HyColor@one
        \else
          \ifx\HyColor@temp\HyColor@dot
          \else
            \HyColor@resultfalse
          \fi
        \fi
      \fi
    \fi
  }%
}{%
  \def\HyColor@MatchNum{%
    (0*1\string\.0*|0*1|0+\string\.?[0-9]*|\string\.[0-9]+)%
  }%
  \def\HyColor@IfRGB#1{%
    \ifnum\pdfmatch{^\HyColor@MatchNum\space\HyColor@MatchNum
        \space\HyColor@MatchNum$}{#1}>\z@
      \let\HyColor@model\HyColor@model@rgb
      \edef\HyColor@values{%
        \expandafter\strip@prefix\pdflastmatch1,%
        \expandafter\strip@prefix\pdflastmatch2,%
        \expandafter\strip@prefix\pdflastmatch3%
      }%
      \HyColor@resulttrue
      \expandafter\@firstoftwo
    \else
      \HyColor@resultfalse
      \expandafter\@secondoftwo
    \fi
  }%
}
\def\HyColor@HyperrefBorderColor#1#2#3#4{%
  \HyColor@IfModel{#1}{%
    \HyColor@IfXcolor{%
      \convertcolorspec\HyColor@model\HyColor@values
                       \HyColor@model@rgb#2%
      \expandafter\HyColor@NormalizeCommaRGB#2\@nil#2%
    }{%
      \ifx\HyColor@model\HyColor@model@rgb
        \expandafter\HyColor@NormalizeCommaRGB\HyColor@values\@nil#2%
      \else
        \ifx\HyColor@model\HyColor@model@gray
          \expandafter\HyColor@NormalizeNum
              \expandafter{\HyColor@values}#2%
          \edef#2{#2 #2 #2}%
        \else
          \let#2\relax
          \HyColor@ErrorModelNoXcolor{#3}{#4}%
        \fi
      \fi
    }%
  }{%
    \let#2\HyColor@values
    \ifx#2\@empty
      \let#2\relax
    \else
      \expandafter\HyColor@IfRGB\expandafter{\HyColor@values}{%
        \expandafter\HyColor@NormalizeCommaRGB\HyColor@values\@nil#2%
      }{%
        \HyColor@IfXcolor{%
          \extractcolorspec{#1}#2%
          \expandafter\convertcolorspec#2\HyColor@model@rgb#2%
          \expandafter\HyColor@NormalizeCommaRGB#2\@nil#2%
        }{%
          \let#2\relax
          \HyColor@ErrorSpecNoXcolor{#3}{#4}%
        }%
      }%
    \fi
  }%
}
\def\HyColor@DetectPdfVersion{%
  \begingroup\expandafter\expandafter\expandafter\endgroup
  \expandafter\ifx\csname Hy@pdfversion\endcsname\relax
    \global\chardef\HyColor@PdfVersion=0 %
  \else
    \global\chardef\HyColor@PdfVersion=\Hy@pdfversion\relax
  \fi
  \global\let\HyColor@DetectPdfVersion\relax
}
\def\HyColor@SpaceToComma#1 #2\@nil{%
  #1%
  \ifx\relax#2\relax
    \expandafter\@gobble
  \else
    ,%
    \expandafter\@firstofone
  \fi
  {%
    \HyColor@SpaceToComma#2\@nil
  }%
}%
\def\HyColor@AttachfileColor#1#2#3#4#5#6{%
  \def#2{#1}%
  \ifx#2\@empty
    \let#3\@gobble
    \let#4\@empty
  \else
    \HyColor@resultfalse
    \HyColor@XZeroOneThreeFour{#1}#3{#5}{#6}%
    \ifHyColor@result
      \edef#2{%
        [rgb]{\expandafter\HyColor@SpaceToComma#3 \@nil}%
      }%
    \fi
    \ifx\HyColor@model\HyColor@model@rgb
      \edef#4{/C[#3]}% hash-ok
      \edef#3##1{%
        #3 %
        \noexpand\csname atfi@SETRGBCOLOR##1\noexpand\endcsname
      }%
    \else
      \ifx\HyColor@model\HyColor@model@gray
        \HyColor@DetectPdfVersion
        \ifnum\HyColor@PdfVersion<7 %
          \edef#4{/C[#3 #3 #3]}% hash-ok
        \else
          \edef#4{/C[#3]}% hash-ok
        \fi
        \edef#3##1{%
          #3 %
          \noexpand\csname atfi@SETGRAYCOLOR##1\noexpand\endcsname
        }%
      \else
        \ifx\HyColor@model\HyColor@model@cmyk
          \HyColor@DetectPdfVersion
          \ifnum\HyColor@PdfVersion<7 %
            \HyColor@IfModel{#1}{%
              \HyColor@IfXcolor{%
                \convertcolorspec\HyColor@model\HyColor@values
                                 \HyColor@model@rgb#4%
                \expandafter\HyColor@NormalizeCommaRGB#4\@nil#4%
                \edef#4{/C[#4]}% hash-ok
              }{%
                \let#4\@empty
                \HyColor@ErrorModelNoXcolor{#5}{#6}%
              }%
            }{%
              \HyColor@IfXcolor{%
                \extractcolorspec{#1}#4%
                \expandafter\convertcolorspec#4%
                    \HyColor@model@rgb#4%
                \expandafter\HyColor@NormalizeCommaRGB#4\@nil#4%
                \edef#4{/C[#4]}% hash-ok
              }{%
                \let#4\@empty
                \HyColor@ErrorSpecNoXcolor{#5}{#6}%
              }%
            }%
          \else
            \edef#4{/C[#3]}% hash-ok
          \fi
          \edef#3##1{%
            #3 %
            \noexpand\csname atfi@SETCMYKCOLOR##1\noexpand\endcsname
          }%
        \else
          \ifx\HyColor@model\HyColor@model@empty
            \PackageError{#5}{%
              Color model `empty' is not permitted for option `#6'%
            }\@ehc
            \let#2\@empty
            \let#3\@gobble
            \let#4\@empty
          \else
            \ifx\HyColor@model\relax % (missing xcolor)
              \let#3\@gobble
              \let#4\@empty
            \else
              \PackageError{#5}{%
                Internal error: unsupported color model%
              }\@ehc
            \fi
          \fi
        \fi
      \fi
    \fi
  \fi
}
%% \section{Installation}
\endinput
%%
%% End of file `hycolor.sty'.
