3

I use xcolor to paint some cells of my table. My input code is \cellcolor[RGB]{129,212,83}. And the output is shown as the attached figure. Then I use a color picker software and find the color is actually RGB={148,209,101}. Just wondering anyone know why there is inconsistency? I am using TexShop with MacTex 2017.

\documentclass[a4paper,11pt]{article}
\usepackage[table]{xcolor}
\begin{document}
\begin{table}[htbp]
  \centering
  \begin{tabular}{@{} c@{}} % Column formatting, @{} suppresses
   {\cellcolor[RGB]{129,212,83}} \\
  \end{tabular}
\end{table}
\end{document} 

enter image description here

  • 3
    Can you provide a minimal example that replicates your output? This way we can investigate. Your minimal example should start with \documentclass and end with \end{document}. – Werner Oct 26 '17 at 19:11
  • Also how exactly are you checking the colors with color picker (a feature I know nothing about). How is the pdf displayed when you test the color? Results may vary from pdf viewer to pdf viewer. – daleif Oct 26 '17 at 19:23
  • 1
    One possibility is that your monitor is using a color transfer function (calibration). Or, the transfer function may be in the PDF software. Then, when it is fed an RGB value, the value is changed before display. I do not think this is caused by color picker, which reports the on-screen RGB value (after correction, if any). To see whether this is the case, find a friend with entirely different computer and PDF viewer. Use a "portable" color picker to compare results. – user139954 Oct 26 '17 at 19:54
  • 1
    I added the code to your question. Comments aren't the best place for it, less people will see, and formatting is not optimal. – Torbjørn T. Oct 26 '17 at 20:01
  • 1
    Compiling the document given in the comment, I get #81D453 with KDE color picker, which is the HEX representation of 129,212,83, as desired – user31729 Oct 26 '17 at 20:01
3

This is actually a graphics art question, not a TeX question. TeX is doing the right thing here.

I know more about color than I do about TeX (that's not saying much). My own computer is color-calibrated, so I tried the above code with color management turned on and off. This is partly a matter of the specific computer, and partly a matter of the software used to view the image.

The compiled document shows the expected color (129,212,83) when used with the Gpick application on Ubuntu, directly viewing the PDF. Same result whether TeX native PDF viewer, Ubuntu native PDF viewer, or Acrobat Reader DC.

If I import the PDF as raster to GIMP, and do NOT use color management, then the color remains the expected (129,212,83). But if I DO use color management in GIMP, the color changes to (91,233,86). The amount of change is specific to my computer; your results would be different.

What this means: RGB=(129,212,83) are merely three numbers fed to the monitor. They do not mean any specific color, believe it or not. But sRGB is color standard, in which the number do have a specific color meaning. So, sRGB=(129,212,83) is a specific color with scientific meaning.

When the graphics application does no color management (many do not, especially PDF readers), the screen is fed the raw RGB value, and produces whichever color is calculated by its internal graphics. But when color managed, the software reads color conversions from a table. It knows that the raw data (129,212,83) does not display the standard sRGB=(129,212,83) on my specific monitor. In order to see sRGB=(129,212,83), the numbers fed to the graphics are automatically changed to (91,233,86).

So, if I pick the color displayed by a color-managed application, the picker detects the managed (91,233,86) rather than the raw (129,212,83). The value stored in the PDF is still (129,212,83). I can see it on my monitor by turning off color management; but then the visible shade of green is not technically the correct sRGB color.

It is possible that your color picker has built-in color management. Some software does. Perhaps it can be turned off. Or, the color management may be done by the platform (I do not have your platform to check that).

  • I think there may be some colour management performed by different readers, just like many output-related nuances are viewer/reader-specific. Using the same colour picker (FSCapture freeware) I managed to see different colour representations (RGB values) under Adobe Reader and SumatraPDF. AR gave RGB = (129,212,83) while SumatraPDF gave RGB = (128,211,82). Even the green in the OP (under Chrome) displays as RGB = (128,212,83). – Werner Oct 26 '17 at 22:50
  • Thanks! This answers a lot. In practice, if I would like to use a color digitizer to pick a particular color and use it in my latex-ed pdf, what scheme should I choose? – honeyclover Oct 26 '17 at 23:28
  • @honeyclover That's a difficult question, if you are looking for scientifically accurate color. Two reasons: (1) Your own computer is probably not calibrated, and (2) You are not viewing under "standard conditions." Best bet: Use sRGB and if the color picker offers to read your display's color profile, say no. That's most likely to work when you are not using color management all the way through. – user139954 Oct 26 '17 at 23:34
  • @honeyclover If you choose sRGB as the colour space in the Digital Color Meter.app you will get the same values as entered in the TeX document. (MacOS). – Alan Munn Oct 27 '17 at 1:53

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.