dvips: Color specials
7.6.2 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.