setrgbcolor via index
I'm trying to add color to an existing text to ps C program. It currently translates a few esc sequences to postscript "cmds" that are in an included .ps file for bold/italics and shading...
I've added a new cmd for color, but I'd rather not have the 3 separate rgb values in the C program, but just pass an index (then translate the index to rgb values in the included .ps file (which also defines the new cmd)
I'm having trouble with the included .ps file getting just the first rgb value rather than the triplet.
here's my ps code...
/color_black { 0 0 0 } def
/color_red { 1 0 0 } def
/color_blue { 0 1 0 } def
/color_green { 0 0 1 } def
/color_mag { 0.83 0.83 0 } def
/color_dict [ color_black color_red color_blue color_green color_mag ] def
/srgb {color_dict exch get setrgbcolor} bind def
% usage
20 20 moveto
0 srgb (black )
1 srgb (red )
show
showpage
please show me the error of my ways!
