Color device configuration
==========================

  To configure Dvips for a particular color device you need to fine tune
the color parameters to match your device's color rendition.  To do
this, you will need a Pantone chart for your device.  The header file
`color.lpro' shows a (rough) correspondence between the Crayola crayon
names and the Pantone numbers and also defines default CMYK values for
each of the colors.  Note that these colors must be defined in CMYK
terms and not RGB, as Dvips outputs PostScript color commands in CMYK.
This header file also defines (if they are not known to the
interpreter) the PostScript commands `setcmykcolor' and
`currentcmykcolor' in terms of a RGB equivalent so if your device only
understands RGB, there should be no problem.

  The parameters set in this file were determined by comparing the
Pantone chart of a Tektronix Phaser printer with the actual Crayola
Crayons.  Because these were defined for a particular device, the
actual color rendition on your device may be very different.  There are
two ways to adjust this.  One is to use the PAntone chart for your
device to rewrite `color.lpro' prior to compilation and installation.
A better alternative, which supports multiple devices, is to add a
header file option in the configuration file (see Configuration file commands)
for each device that defines, in `userdict', the color
parameters for those colors that need redefining.

  For example, if you need to change the parameters defining
`Goldenrod' (approximately Pantone 109 on the Phaser) for your device
`mycolordev', do the following.  In the Pantone chart for your device,
find the CMYK values for Pantone 109.  Let's say they are `{\ 0 0.10
0.75 0.03 }'. Then create a header file named `mycolordev.pro' with the
commands

     userdict begin
     /Goldenrod { 0 0.10 0.75 0.03 setcmykcolor} bind def

Finally, in `config.mycolordev' add the line

     h mycolordev.pro

This will then define `Goldenrod' in your device's CMYK values in
`userdict' which is checked before defining it in `TeXdict' by
`color.pro'.  (On MS-DOS, you will have to call this file
`mycolordev.cfg'.)

  This mechanism, together with additions to `colordvi.tex' and
`blackdvi.tex' (and the `.sty' files), can also be used to predefine
other colors for your users.

Color support details
=====================

  To support color, Dvips recognizes a certain set of specials.  These
specials start with the keyword `color' or the keyword `background',
followed by a color specification.

Color specifications
--------------------

  What is a color specification?  One of three things.  First, it might
be a PostScript procedure as defined in a PostScript header file.  The
`color.pro' file defines 64 of these, including `Maroon'.  This
PostScript procedure must set the current color to be some value; in
this case, `Maroon' is defined as `0 0.87 0.68 0.32 setcmykcolor'.

  The second possibility is the name of a color model (initially, one of
`rgb', `hsb', `cmyk', or `gray') followed by the appropriate number of
parameters.  When Dvips encounters such a macro, it sends out the
parameters first, followed by the string created by prefixing
`TeXcolor' to the color model.  Thus, the color specification `rgb 0.3
0.4 0.5' would generate the PostScript code `0.3 0.4 0.5 TeXrgbcolor'.
Note that the case of zero arguments is disallowed, as that is handled
by the single keyword case (`Maroon') above, where no changes to the
name are made before it is sent to the PostScript file.

  The third and final type of color specification is a double quote
followed by any sequence of PostScript.  The double quote is stripped
from the output.  For instance, the color specification `"AggiePattern
setpattern' will set the `color' to the Aggie logo pattern (assuming
such exists.)

Color specials
--------------

  We will describe `background' first, since it is the simplest.  The
`background' keyword must be followed by a color specification.  That
color specification is used as a fill color for the background.  The
last `background' special on a page is the one that gets issued, and it
gets issued at the very beginning of the page, before any text or
specials are sent.  (This is possible because the prescan phase of
Dvips notices all of the color specials so that the appropriate
information can be written out during the second phase.)

  The `color' special itself has three forms.  The first is just
`color' followed by a color specification.  In this case, the current
global color is set to that color; the color stack must be empty when
such a command is executed.

  The second form is `color push' followed by a color specification.
This saves the current color on the color stack and sets the color to be
that given by the color specification.  This is the most common way to
set a color.

  The final version of the `color' special is just `color pop', with no
color specification; this says to pop the color last pushed on the
color stack from the color stack and set the current color to be that
color.

  Dvips correctly handles these color specials across pages, even when
the pages are repeated or reversed.

  These color specials can be used for things such as patterns or
screens as well as simple colors.  However, note that in the
PostScript, only one color specification can be active at a time.  For
instance, at the beginning of a page, only the bottommost entry on the
color stack is sent; also, when a color is popped, all that is done is
that the color specification from the previous stack entry is sent.  No
`gsave' or `grestore' is used.  This means that you cannot easily mix
usage of the `color' specials for screens and colors, just one or the
other.  This may be addressed in the future by adding support for
different categories of color-like state.