[Tex/LaTex] Using colors defined with spotcolor.sty in TikZ

colortikz-pgf

I would like to specify pantone colors. spotcolor.sty seems to to the trick when compiled with pdfLaTeX:

\documentclass{article}
\usepackage{color}
% \usepackage{xcolor} % Does not work
\usepackage[pantone]{spotcolor}

\SetPageColorSpace{PANTONE}%
\definecolor{mycolor}{spotcolor}{PANTONE273PC,1.0}%

\begin{document}

{\color{mycolor}\rule{4cm}{3cm}}

\textcolor{mycolor}{Colored text}

\end{document}

but spotcolorit is incompatible with xcolor which is loaded by TikZ. Is it somehow possible to get xcolor and TikZ to work together with spotcolor so I can do something like:

\documentclass{article}
\usepackage{tikz}
\colorlet{mycolor}{blue}

% Does not work
% \usepackage[pantone]{spotcolor}
% \SetPageColorSpace{PANTONE}%
% \definecolor{mycolor}{spotcolor}{PANTONE273PC,1.0}%

\begin{document}

\begin{tikzpicture}
    \node[fill=mycolor,minimum width=4cm,minimum height=3cm] (rule) {};
    \node[mycolor,anchor=north west] at (rule.south west) {Colored text};
\end{tikzpicture}

\end{document}

Edit:

I can load xcolor after defining my pantone colors but TikZ still does not like it:

\documentclass{article}
\usepackage{ltxcmds}
\usepackage{color}
\usepackage[pantone]{spotcolor}
\SetPageColorSpace{PANTONE}%
\definecolor{mycolor}{spotcolor}{PANTONE273PC,1.0}%
\usepackage{xcolor}
% \usepackage{tikz}

\begin{document}

{\color{mycolor}\rule{4cm}{3cm}}

\textcolor{mycolor}{Colored text}

\colorlet{mysecondcolor}{red}

{\color{mysecondcolor}\rule{4cm}{3cm}}

\textcolor{mysecondcolor}{Colored text}

\makeatletter
\ltx@ifpackageloaded{tikz}{%
\begin{tikzpicture}
    \node[fill=mycolor,minimum width=4cm,minimum height=3cm] (rule) {};
    \node[mycolor,anchor=north west] at (rule.south west) {Colored text};
\end{tikzpicture}}{}
\makeatother

\end{document}

Best Answer

it is simple to declare a package as loaded:

\makeatletter
    
\@namedef{ver@xcolor.sty}{}

\makeatother
\RequirePackage{color}
\documentclass{article}

\usepackage{tikz}

....

but that won't solve your problem, pgf relies heavy on the xcolor routines. It has a lot of macros which are unknown to package color, e.g. \colorlet