Named color detection
This page applies to Harlequin v13.1r0 and later; both Harlequin Core and Harlequin MultiRIP.
Sometimes, it is desirable to detect when named colors are being used and act on that knowledge without actually intercepting named colors. This is one way of doing that:
currentglobal false setglobal
<<
/print_str 256 string
/Lookup {
% on stack: NCD colorant
exch pop
% Prints the colorant name on stdout
(Seen ) print print_str cvs print (\n) print
false
% on stack: false
}
>>
/PrintColorants exch /NamedColor defineresource pop
setglobal
which defines an NCD called PrintColorants
. The important detail is that Lookup
always returns false
, which means that this NCD never provides equivalent values for named colors. As a result, the ColorSpace
and TintTransform
elements are not used and do not need to be in the NCD for this special case. In this example, the colorant name is printed to the standard output whenever the RIP is trying to convert it through a tint transform.
To guarantee that this NCD is called for all named colorants seen in the job, it should be placed in the first slot of the list of NCDs, see Named color management.