13

Whenever I force the PDF/A format for my document, loading the tikz package changes the color scheme of the document from RGB to CMYK, notably the magenta default color of URLs.

\documentclass[margin=1pt]{standalone}
\usepackage[a-1b]{pdfx}
\usepackage{hyperref}
%\usepackage{tikz} % Uncomment changes the color of magenta from RGB to CMYK
\hypersetup{colorlinks=true}

\begin{document}
\url{http://jill-jenn.net}
\end{document}

The top one (RGB) is what I obtain if tikz is not loaded, the bottom one (CMYK) is what I obtain if tikz is loaded.

Different color schemes

My questions are linked:

  • Do you know what specific part of tikz is responsible for this switch? How to find it?
  • Is it normal that RGB's magenta and CMYK's magenta do not look the same?
  • Is there a way to prevent tikz from suddenly switching the whole color scheme?
2
  • 1
    One difference is that hyperref uses color whereas tikz uses xcolor. – John Kormylo Jan 6 '17 at 6:11
  • The top one is CMYK magenta (via default PDF screen rendering) and the bottom one is RGB magenta (PDF-A requires RGB color model). – Paul Gaborit Jan 6 '17 at 9:30
9

Extract from pdfx documentation: "PDF/A and PDF/E usually need an RGB profile". You may force RGB colors using the rgb option when thexcolor package is loaded:

\documentclass[margin=1pt]{standalone}
\usepackage[rgb]{xcolor}
\usepackage[a-1b]{pdfx}
\usepackage{hyperref}
\hypersetup{colorlinks=true}
\begin{document}
\url{http://jill-jenn.net}
\end{document}
8

The tikz package loads the xcolor package which is partially responsible for the change in your url colors. This can be easily fixed by placing your \hypersetup{colorlinks=true} before the tikz package and the color will be defined as RGB magenta before the tikz package is loaded, resulting in the original color. Here is a MWE (note: i have the pdfx package commented out):

\documentclass[margin=1pt]{standalone}
%\usepackage[a-1b]{pdfx}
\usepackage{hyperref}
\hypersetup{colorlinks=true}
\usepackage{tikz}
\begin{document}
\url{http://jill-jenn.net}
\end{document}

However, because you are using the pdfx package with a-1b option this will not work. I don't really know what this package is about, but I think that, after a quick search on its source code, it literally states it will use the default CMYK color magenta for urlcolors (line 1833) which is possible whenever the xcolor package is loaded:

%% \def\@urlcolor{0 1 0 0}%

which would define the color you see in your output as it is in CMYK. If you don't use the pdfx package it keeps your original color value as long as you define it before loading the tikz (and thus indirectly, xcolor) package. I couldn't load the hyperref package before the pdfx package though, so the same solution used for the tikz package cannot be used here. I cannot help you further as I have never used this pdfx package.

8

As to your second question: it is normal, that an RGB and an CMYK color does not look the same. To understand why, I have to tell some details.

You have to know, that there are at least two different ways of "getting color" into your life.

Lets have a closer look at your computer monitor. If you switch it off, it shows its "natural" color, which is kind of black. When you turn it on and you control the amount of light it emits, the color changes from black to all kind of colors into finally a crisp white light. In fact, each so called pixel on your monitor consists of three light emitting sources: a red, a green and a blue subpixel. The colors of the subpixels gave their initials for this color mixing scheme: RGB (which is Red, Green and Blue). One also speaks from an additive mixing scheme: If none of the pixels are emitting light, the sum of the pixels appear to be black. If you turn on only the red pixel to 100 % intensity, you will only see a red light. If you turn on red, green and blue to 50 % intensity each, you will get a medium gray and finally, all three at 100 %, you'll receive pure white.

This was the additive way to mix colors from three basic colors.

Now, lets have a look at the colors you'll see, if you look at a sheet of paper coming out of your color printer.

The impression of color is created on a completely different physical effect. Please imagine yourself, you are standing on a sunny day outside and are looking at your colored print out. In that case, the white sunlight will fall an your white sheet of paper, which will reflect the sunlight at a 100 %. This reflected ray of sunlight catches your eye and that will resemble a white color for you. Now have a look at another area of your printout. This time, we'll have a closer look to an area, where the printer has applied some of its color particles. Again, a pure white ray of light comes from the sun, but this time, it has to pass the colored printer particles. These particles act as a filter by deleting some colors from the "white" sun light. (In fact, the white sunlight is also set up by addition of blue, green and red colors you see in a rainbow.) After having lost some of the colors, the remaining rest of the sun ray reaches the white paper beneath the color particles and is again reflected into your eye. But this time, you'll notice it as a colored patch. Interestingly, by having lost some of its colors, the rest of the colors form a new color. This is the process of mixing color by subtracting some colors from a white light of full spectrum of colors.

This subtractive model works with the opponent colors to RGB, which are Cyan, Magenta and Yellow, which form the three first letters of the CMYK-model. The remaining K letter represents the "key" color, which is black. You'll add a black filter particle to your paper, to ensure, that this area is completely black.

You can also mix some of the three CMY components with black and you will get a warmer of colder toning of black.

If you happen to have a not so white light, the effect of the objected color will vary dramatically, as well, as it differs, if your paper has one tone of white or another.

This is different, as the RGB system creates a color, where there was no color before. The outcome should be more or less identical every time. On the other hand, the CMYK removes some colors from a more ore less white light. The influences on the mixing process -- as described above -- can change the result a lot.

I hope, I was able, to make the difference between RGB (additive color mixing model, based on three basic colors) and CMYK (subtractive color mixing by removing colors by means of four different filters from white light) clear.

Therefore, it is difficult, to recalculate one color from RGB to CMYK and vice versa.

2
  • 1
    +1 for this easy to understand yet quite detailed write-up. Thanks. – JiyuuSensei Jan 6 '17 at 14:41
  • You are very welcome. – Jan Jan 6 '17 at 18:21

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.