% Control script for PStill to rewrite colors (interpreted as grays) to a specify color value % This is the CMYK color for the output: variable newcolor=[0.4,0.6,0.3,0.0]; define interceptEOFill() { variable colorspace; variable gray; colorspace = currentColorspace(); gray = 1.0 - currentGrayColor(); if (colorspace < 4) { % we change only DEVICEGRAY,RGB and CMYK Colorspaces if ( gray > 0.0 ) { % only for non-white setCMYKColor(newcolor[0] * gray, newcolor[1] * gray, newcolor[2] * gray,newcolor[3] * gray); % paint in new color [0.4,0.6,0.3,0.0] } else { setCMYKColor(0.0,0.0,0.0,0,0); % paint white as white } } } define interceptFill() { variable colorspace; variable gray; colorspace = currentColorspace(); gray = 1.0 - currentGrayColor(); if (colorspace < 4) { % we change only DEVICEGRAY,RGB and CMYK Colorspaces if ( gray > 0.0 ) { % only for non-white setCMYKColor(newcolor[0] * gray, newcolor[1] * gray, newcolor[2] * gray,newcolor[3] * gray); % paint in new color [0.4,0.6,0.3,0.0] } else { setCMYKColor(0.0,0.0,0.0,0,0); % paint white as white } } } define interceptShow() { variable colorspace; variable gray; colorspace = currentColorspace(); gray = 1.0 - currentGrayColor(); if (colorspace < 4) { % we change only DEVICEGRAY,RGB and CMYK Colorspaces if ( gray > 0.0 ) { % only for non-white setCMYKColor(newcolor[0] * gray, newcolor[1] * gray, newcolor[2] * gray,newcolor[3] * gray); % paint in new color [0.4,0.6,0.3,0.0] } else { setCMYKColor(0.0,0.0,0.0,0,0); % paint white as white } } } define interceptStroke() { variable colorspace; variable gray; colorspace = currentColorspace(); gray = 1.0 - currentGrayColor(); if (colorspace < 4) { % we change only DEVICEGRAY,RGB and CMYK Colorspaces if ( gray > 0.0 ) { % only for non-white setCMYKColor(newcolor[0] * gray, newcolor[1] * gray, newcolor[2] * gray,newcolor[3] * gray); % paint in new color [0.4,0.6,0.3,0.0] } else { setCMYKColor(0.0,0.0,0.0,0,0); % paint white as white } } }