Skip to content

Named Colors

Terry Burton edited this page Jun 4, 2024 · 2 revisions

Named Colors

Colors can be predefined, given a name, and then referenced by BWIPP.

For example:

%!PS

...
%%DocumentCustomColors: (Poison Ink)
...

% Include BWIPP resources here

...

%
%  Define some named colors within the global BWIPP context:
%
%  - Color names must begin with underscore.
%  - They are specified as an array containing their colorspace definition and
%    their color components within their colourspace.
%
/uk.co.terryburton.bwipp.global_ctx <<
    /named_colors <<
        /_blue [ /DeviceRGB  0.0 0.0 1.0 ]
        /_registration [ /DeviceCMYK  1.0 1.0 1.0 1.0 ]
        /_poisonink [
            [ /Separation (Poison Ink) /DeviceCMYK { dup 0.49 mul exch dup 0 mul exch dup 0.03 mul exch 0 mul } ]  1.0
        ]
    >>
>> def

...

%
%  Reference the colours by their name
%
10 10 moveto (Lick me) (backgroundcolor=_poisonink) /qrcode /uk.co.terryburton.bwipp findresource exec

...

showpage
Clone this wiki locally