Colors defined via the internal \definecolor
macro in ConTeXt cannot be used in TikZ when the CMYK system is used.
Is there a way to convert them or tick a setting so that TikZ can use them?
Minimal example:
\usemodule[tikz]
\definecolor[c][c=1]
\starttext
\tikz\node[c]{t};
\stoptext
Expected: cyan “t”
Received: black “t” and Package pgf: Error! Color c has an unsupported color model..
Edit: TikZ does use ConTeXt colors defined with the RGB color model:
\definecolor[r][r=1]
\tikz\node[r]{t};
This gives me a red “t” as expected. So I don’t want to know how to define colors explicitly for use in TikZ, but what code I have to add somewhere add to make the two lines\definecolor[c][c=1]
and \tikz\node[c]{t};
from the minimal example work together.
Best Answer
It seems that
pgf
does not have any built-in support forcmyk
when using ConTeXt. As a result, the macro\pgfutil@registercolor
, which chooses colour models, is hard-coded not to try anything other thanrgb
andgray
. Thus we need alter that macro and provide the necessary internal conversion:Original answer (to a slightly different question!)
Two things are going on here. First,
pgf
does not support ConTeXt's\definecolor
: there is a note to the effect in the manual. So you need to use\pgfutil@definecolor
instead. Secondly, there is no built-in code for acmyk
model when working with ConTeXt. However, this does not seem to be too hard to emulate: