While printing my thesis in a professional printing shop I encountered various issues. First, pages with grayscale graphics have not been recognized as such (requires manual fixing by the shop) and and also have a color tint, which I assume comes from color conversions and a not perfectly calibrated printer. I learned about the command \selectcolormodel{gray}, which is a quick fix for the first issue, and that I should define gray colors with \definecolor{xxx}{gray}{0.5} instead of \definecolor{xxx}{rgb}{0.5,0.5,0.5} to actually fix both issues. So far so good.

But there remains one case I could not fix: graphics with color components, so I cannot use \selectcolormodel{gray} and grayshade gradients occurring at the same time. Even if I define the shade/fading with true grayscale colors, it gets converted to rgb/cmyk in the end, so that again there is a color tint in the print. Is this a bug? Is it by design? Is there a fix?

Thank you very much!





%\selectcolormodel{gray}  % only fix for entire document


%% mixed colors! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\node[single arrow, left color=grau+, right color=grau-,
      minimum height = 7.5cm] at (0,0) {Hello World!};
\shadedraw[top  color=gray!30, bottom color=gray!30, middle color=white, thin, yshift =1cm, xshift =-3cm] 
    (0,-2) -- ++(0, 2) -- ++(-2, 0) -- ++(0, -2) -- cycle;

%% true grayscale! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\node[single arrow, fill=grau+,                          
%     minimum height = 7.5cm] at (0,0) {Hello World!};
%\draw[fill=gray, thin, yshift =1cm, xshift =-3cm] 
%    (0,-2) -- ++(0, 2) -- ++(-2, 0) -- ++(0, -2) -- cycle;


How to check for true grayscale

To check whether an output pdf contains only grayscale I installed Ghostscript and use a batch-file (drag and drop the pdf on the batch file):

gswin64c.exe -o - -sDEVICE=inkcov "%~1"

For a true grayscale pdf the output only has value at the 4th position::

Page 1
 0.00000  0.00000  0.00000  0.43900 CMYK OK

For a color containing pdf the output shows values at all positions:

Page 1
 0.41208  0.41208  0.40833  0.10622 CMYK OK

Complex Example

Consider the following graphic. When printed, the lower "cylinder" has a color tint when printed, because the grayshade is converted to a color mix. That is what I would like to avoid.

enter image description here

  • 1
    Use \usepackage[gray]{xcolor}. Sep 30, 2021 at 14:16
  • @UlrikeFischer but than everything colored is gray, it has basically the same effect as ´\selectcolormodel{gray}´ for my case. My problem are graphics with colored objects and grayscale gradients at the same time, where I cannot use your suggestion. Sorry, if that was not clear in my question. Sep 30, 2021 at 16:27
  • sorry but your example doesn't contain anything with colors. So it is not quite clear which colors you want to retain. But you can use \selectcolormodel{gray} locally to force a gray model if needed. Sep 30, 2021 at 16:38
  • @UlrikeFischer because, if I would have included colored objects in the MWE, than one could not have used the proposed method to check for a true grayscale. It appeared to me to be rather confusing than helping. I will try using \selectcolormodel locally as a workaround, but it does not really answer the question, why gradients change grayscales to color. Thank you anyway! Sep 30, 2021 at 19:15

1 Answer 1


Shadings are special objects in a PDF. The code pgf uses to create such a shading starts like this:

  \def\pgf@shading@device{/DeviceRGB}% <-------------- 1
  \def\pgf@shading@functional@range{0 1 0 1 0 1}%
    \def\pgf@shading@functional@range{0 1 0 1 0 1 0 1}%
  \ifx\pgf@mod@test\XC@mod@gray %<----------------------2
    \def\pgf@shading@device{/DeviceGray}% %<------------3
    \def\pgf@shading@functional@range{0 1}%

The line marked with 1


means that the default colorspace for a shading is /DeviceRGB, so rgb.

The lines 2 + 3 mean that you get a shading using /DeviceGray if you set the colormodel of xcolor locally or globally to gray.

  • Thank you very much for that explanation! Also, I one can prove that locally setting the color model to gray actually works by including e.g. a cyan shape, so the output of the ghostscript cmd command is 0.XXXXX 0.00000 0.00000 0.XXXXX CMYK OK, which means the grayscale gradient must be a true grayscale. It think the way how pgf choses the color model for shading could be improved to avoid such issues in the first place. But the workaround is also fine. Oct 1, 2021 at 9:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .