xref: /plan9-contrib/sys/src/cmd/postscript/mcolor/color.sr (revision 219b2ee8daee37f4aad58d63f21287faa8e4ffdc)
1.ds Dc black
2.ds Cc \*(Dc
3.de CL	\" Color selection macro
4.	\"
5.	\"	$1=color (e.g. .CL red) or
6.	\"	$1=textcolor on backgroundcolor (e.g. .CL "red on blue")
7.	\"	$1=red green blue rgb (e.g. .CL ".2 .3 .4 rgb") or
8.	\"	$1=hue saturation brightness hsb (e.g. .CL ".5 .6 .7 hsb")
9.	\"	$2=text
10.	\"
11.	\" If no arguments are given the default color (usually black) will be
12.	\" restored. If $2 is omitted the color selected by $1 remains in effect
13.	\" until another color is selected. If two arguments are given $2 will be
14.	\" printed in color $1 and then the default color will be restored.
15.	\"
16.	\" The color of the text and the background can be selected by setting $1
17.	\" to "textcolor on backgroundcolor" where textcolor and backgroundcolor
18.	\" can be any of the known colors. For example use .CL "white on black"
19.	\" for reverse video printing. Changing color in a word can be accomplished
20.	\" by preceeding the characters with a \X'SetColor:val' command, where val
21.	\" is the color you wish to use. Named colors are case independent.
22.	\"
23.	\" Implementation details are device dependent and are handled in the
24.	\" appropriate post-processor. Requesting a color that's not available
25.	\" (eg. not defined in /usr/lib/postscript/color.ps) results in the use
26.	\" of default colors - black or white on black for reverse video mode.
27.	\"
28.	\" All colors may not be supported on every output device, and the direct
29.	\" specification of a color via an explicit rgb or hsb argument may also
30.	\" be device dependent. In any case, to be safe on PostScript devices, all
31.	\" numeric paramenters in the direct rgb or hsb specifications should lie
32.	\" between 0 and 1 (inclusive). The names of the currently available colors
33.	\" on PostScript printers are listed in file /usr/lib/postscript/color.ps.
34.	\"
35.mk Ov
36.if \\n(.$=0 .ds Cc \\*(Dc
37.if \\n(.$=1 .ds Cc \\$1
38.if \\n(.$<2 \\X'SetColor:\\*(Cc'
39.if \\n(.$=2 \\X'SetColor:\\$1'\\c
40.if \\n(.$=2 'sp |\\n(Ovu
41.if \\n(.$=2 \\$2
42.if \\n(.$=2 .mk Ov
43.if \\n(.$=2 \\X'SetColor:\\*(Cc'\\c
44'sp |\\n(Ovu
45..
46