This is a MWE:




    My color model: \tmpmodel

    My color spec: \tmpcolorspec


    My color in cmyk: \cmykcolorspec


    My color in HTML: \htmlcolorspec\\

    \colorbox{mycolor}{\parbox[b][5em]{4em}{\tiny mycolor}}
    % Change color model
    \colorbox{mycolor}{\parbox[b][5em]{4em}{\tiny mycolor cmyk}}
    \colorbox{mynewcolor}{\parbox[b][5em]{4em}{\tiny mynewcolor}}
    \colorbox{mylastcolor}{\parbox[b][5em]{4em}{\tiny mylastcolor}}

This is the result:

enter image description here

Notice that mycolor is defined using an HTML model: 4CAF50. The color model selected by xcolor as default is rgb, as we can see from the extracted model. The color specification for this rgb model is 0.29805,0.68626,0.31374, which is indeed the same as that we can get using some online color converter (https://www.colorhexa.com/4caf50). The color specification after a cmyk conversion is 0.38821,0,0.37251,0.31374, which is completely different from almost any conversion performed online, for example, is this site the result is 0.5656,0,0.5429,0.3137. Finally, as you can see, the HTML specification corresponds to the original value, so we can think that rgb-to-HTML conversion is performed properly but rgb-to-cmyk doesn't.

We are working here with two completely different color spaces, it is understandable that the colors look different from one space to another, you can see the same think in applications like Adobe Photoshop as well. The problem here is the apparent error in the color conversion when we go from rgb to cmyk.

Why is this happening? How can I correct it? Is there some parameter that I am missing?


I get your cmyk-values with the following calculation steps:

  c= 1-r = 0.70195
  m= 1-g = 0.31374
  y= 1-b = 0.68626

  k = min(c,m,y) = 0.31374

  c = c-k = 0.38821
  m = m-k = 0
  y = y-k = 0.37252

This rather simple conversion method is described in the postscript manual (https://www.adobe.com/content/dam/acom/en/devnet/actionscript/articles/psrefman.pdf, page 305 ff). It is certainly one possibility to calculate the conversion.

But if you want to get completly confused about the "correct" conversion formula, you could read this thread https://forums.adobe.com/thread/428899.

  • 2
    perhaps add a pointer to xcolor doc which says page 50 Conversion cmy to cmyk. This is probably the hardest of our conversion tasks: many sources emphasize that there does not exist any universal conversion algorithm for this case because of device-dependence. And it seems rgb -> cmyk is done as rgb -> cmy -> cmyk. (guessing) – user4686 Jun 12 '18 at 9:33
  • Oh, I see... So it is not a wrong calculation, is it? :) I've made the question because I saw this: tex.stackexchange.com/questions/371958/…, in which the OP assumes the conversion produces bad color definitions. – osjerick Jun 12 '18 at 10:01

Not really an answer. Just a code to visualize better the difference. As you can see below there is consistency across conversions. About the conversion in cmyk, as jfbu states in his/her comment, doesn't exist only one conversion algorithm because of device dependence.


  • Unfortunately I think that in order to have the best result is to print a sample page with all the colors you use in your palette (and maybe some variants) and based on the result eventually modify the palette in your document. – gvgramazio Jun 12 '18 at 10:10

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.