Imagine the PDF file that you create from the tex sources has to have all colors defined in RGB because the PDF is meant to be read on screen.

One would do:

\xdefinecolor{colordef-listings-backgroundcolor-grey}{RGB}{219, 219, 219}

What if you ALSO want the same document to be printed, while printing is done in CMYK. You would have to do:

\xdefinecolor{colordef-listings-backgroundcolor-grey}{cmyk}{0.0, 0.0, 0.0, 0.14}

How do I get both into one PDF? Or how to I "conveniently" create one or the other?


Package xcolor allows one to write

\definecolor{red}{rgb/cmyk}{1,0,0/0,1,1,0} % an example in manual


\usepackage[rgb]{xcolor} % or

So you may compile twice with rgb or cmyk loaded alternatively. See the subsection Multiple models and specifications for more information.

And as a remark, I am afraid a PDF file cannot recognize whether the target device is a screen or a printer. But I wonder why you want/need to convert color model by hand. Are you going to choose colors on color guides?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.