Skip to main content
Skip table of contents

Named color database resources


This page applies to Harlequin v13.1r0 and later; both Harlequin Core and Harlequin MultiRIP.

NamedColor resources are PostScript language dictionary resources in the NamedColor category. As is normal for resources, disk-based NamedColor resources are found in the SW/NamedColor directory, and resources may be defined dynamically in PostScript language code. They contain a set of named colors and their equivalent values in an alternate color space, amongst other things. For most use cases the HqnColorDatabase procset calls documented in HqnColorDatabase procset are the easiest way to add new NamedColor resources, but creating NamedColor resources by writing your own Lookup procedure (see below) may occasionally be required.

To build a NamedColor resource dictionary (NCD) from scratch, include these entries:

ColorSpace

(Required either in the NCD or in the dictionary returned by the Variant 2 Lookup) the alternate space which will replace the alternate space in a Separation color space from the job. It is used for all colorants in this resource. It may be any of the PostScript or PDF color spaces with the exceptions of Indexed and Pattern.

It must be a color space array; if the color space is a device space, it must be in the array form (for example, [/DeviceCMYK]).

If the ColorSpace is a /DeviceN, in most use cases all the colorants in the colorant list are renderable on the device. If the colorants are not renderable, the RIP attempts to use the alternate space and tint transform as normal for /DeviceN spaces. Since the NCD has already applied its own tint transform, this means applying a second tint transform from the /DeviceN ColorSpace. If there is more than one colorant in the colorant list, there are restrictions on the second tint transform; these are the same as those specified in Named color database resources.

Lookup

(Required) a procedure to determine if this colorant should be replaced by this resource, and to obtain its solid color equivalent. The procedure is called with the NCD and the name of the colorant in question on the operand stack (as a string or name).

If this colorant is not to be replaced, the procedure should remove both operands and return false:

NCD colorant -> Lookup -> false

If this colorant is to be replaced, two approaches are supported:

Variant 1:

If all colorants to be replaced by this NCD will use the same color space for the replacement, then define the ColorSpace entry in the NCD as described above, and return an array of color values for the solid of the colorant being replaced in that color space and true on the operand stack:

NCD colorant -> Lookup -> [ solid-color-values ] true

The array must include the correct number of color values, in the correct range, for the ColorSpace specified in the NCD. As an example, if ColorSpace is [ /DeviceCMYK] , then the color value array returned for a bright red colorant might be [ 0 1 1 0 ].

This array must be unique to each call to Lookup. The means of obtaining the solid colors is not defined, but some methods are in Named color lookup examples.

If this variant is used, TintTransform must be defined in the NCD; see below.

Variant 2:

Alternatively, the Lookup procedure can dynamically select or construct the color space in which the values are returned and include the color space and tint transform in a dictionary that is returned with true:

NCD colorant -> Lookup -> dict true

The returned dictionary may contain a ColorSpace entry, exactly as described above; if ColorSpace is not defined in the returned dictionary then it must be defined in the NCD itself. TintTransform must be defined in the returned dictionary; any TintTransform defined in the NCD is ignored.

The TintTransform in the returned dictionary must be a complete procedure, exactly as would be used as the fourth element of a color space array. It must accept a single value and return a set of color values suitable for the selected ColorSpace. An example of such a tint transform for a DeviceCMYK ColorSpace:

CODE
{
  [ 0.0 0.8 0.8 0.3 ]
  {1 index mul exch } forall pop% the tint
} bind

TintTransform

Procedure, required either in the NCD or in the dictionary returned by Lookup, but note that the values must be structured differently for Variants 1 and 2 above.

Variant 1:

In the case where the Lookup procedure returns an array a color values, a TintTransform procedure must be defined in the NCD. In this case the procedure must consume a color value for the spot being replaced, and the array of color values as returned by Lookup.

tint [solid_1 ... solid_N] -> TintTransform -> tint_1 ... tint_N

An example might be:

CODE
/TintTransform {
  {
    1 index mul exch
  } forall pop
} bind


Variant 2:

In the case where the Lookup procedure returns a dictionary in which TintTransform is defined, any TintTransform defined in the NCD is ignored.

AllowColorManagement

(Optional) a Boolean, default: true.

For resources that have a ColorSpace entry of /DeviceCMYK, /DeviceRGB, or /DeviceGray, it determines whether the output is further color managed by setinterceptcolorspace appropriate to a normal device space. If true, the output color is processed by the intercept profile; otherwise it is not. In both cases, the color is processed by /NextDevice entries in setreproduction, if present. This allows emulation or ink limiting to act on the results of named color replacement.

For resources that have a ColorSpace entry of /DeviceN or Separation, it determines whether any further color management is applied. If true, the color is processed by /NextDevice entries in setreproduction, if present. Otherwise, the color is sent to the output device either directly or indirectly via the tint transform of the ColorSpace entry.

For resources with other ColorSpace entries, AllowColorManagement has no effect. They are further color managed as though the original color space was ColorSpace and not a named color.

AllowColorManagement is ignored if an ID key is present with a non-null value. For examples of AllowColorManagement use, see Illustrations of controlled merging of spots with color pipelines.

ID

(Optional) An integer, name, string, or null.

Default: null.

Subject to the following caveats, after extracting the named color's equivalent value from the resource, the color is passed directly to the /NextDevice transform with the matching ID, see ID in setreproduction. Any transforms before this in the color pipeline are bypassed. In a color configuration with several /NextDevice transforms, this allows resources to have their colors processed by the most appropriate /NextDevice transform. For example, if there are several CMYK /NextDevice transforms in the pipeline each with different printing conditions.

The ID key only has effect if the ColorSpace of the resource is /DeviceCMYK, /DeviceRGB, /DeviceGray, /DeviceN, or /Separation; otherwise, it is ignored.

If an ID key is present and not null, setreproduction must be configured with a /NextDevice dictionary containing a matching ID value; see Illustrations of controlled merging of spots with color pipelines. Otherwise, an error is thrown. The matching /NextDevice may be configured at any position in a color pipeline with many /NextDevice transforms.

All of the colorants present in the ColorSpace entry must be accepted by the matching /NextDevice (that is, the input colorants of the matching /NextDevice must be a non-strict superset of the resource's ColorSpace. An error is thrown if one or more of the colorants of the resource aren't accepted by the /NextDevice.

For the purpose of ID matching, names and strings are considered equivalents.

It is important that a tint of 0 should map to no ink, and that a tint of 1 should map to the solid color. Failure to observe these restrictions may result in artifacts when spots are used in transparency jobs and when OverprintPreview is active.

NC-setID

Setting the ID key of a particular resource normally requires knowledge of the precise color configuration. In particular, it requires knowledge of the ID keys associated with each NextDevice transform. Therefore, setting the ID key is normally done at runtime after placing NamedColor resources in the graphics state using setinterceptcolorspace. That is achieved using the NC-setID procedure from the HqnNamedColor procset:

ID resource-name NC-setID –

where ID is the integer, name or string used for the ID, and resource-name is the name of a NamedColor resource. It is often convenient to define this procedure in a local name before use, with this line:


CODE
/NC-setID /HqnNamedColor /ProcSet findresource /NC-setID get def




These are examples of how to use NC-setID:


CODE
1 /SWOP_NCD NC-setID
/a-name /Calibrated_NCD NC_setID
(a-string) /Output_NCD NC-setID


where each of the three NCDs in the examples use different printing conditions.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.