[Tex/LaTex] Can \usepackage{color} and \input tikz work together in Plain TeX/eplain

colorplain-textikz-pgf

I use Plain TeX and Eplain. In my document I'm using both the color and url packages inside the \beginpackages..\endpackages block. Just now I tried adding \input tikz.tex (as the TikZ manual states) to the document and got the error:

Package pgfbase: Error! Unsupported color model `'. Sorry.

over and over. The document's colors were all wrong (indeed, they were gone) and the document looked terrible.

I figured that the color package somehow conflicted so I removed that and disabled the hyperlinks I was using which automatically introduce color.

Is there any way to get the color package with Eplain and TikZ to play nicely together? I'd rather not disable hyperlinks.

Edited to add:

Here's a sample input file, as requested.

\input eplain
\beginpackages
  \usepackage{url}
  \usepackage{color}
\endpackages
\enablehyperlinks
\hlopts{}

\input tikz


\definexref{anchor}{display}{type} Hi there. This refers to the \ref{anchor}.

\bye

This file will produce the warning above and also produce odd-looking PDF output. Without the \input tikz it should look normal.

Best Answer

Set the colors after loading tikz; moreover use the following pattern:

\input eplain
\beginpackages
  \usepackage{url}
  \usepackage{color}
\endpackages

\input tikz

\enablehyperlinks
\definecolor{urlcolor}{rgb}{.2,.4,.6}
\hlopts{colormodel=,color=urlcolor}

\definexref{anchor}{display}{type} Hi there. This refers to the \ref{anchor}.

\bye

Using

\hlopts{colormodel=rgb,color={.2,.4,.6}}

(that according to the docs should work) breaks tikz. Remember that tikz supports only the rgb and gray color models.