Discussion:
Wrong colors with xcolor?
(too old to reply)
Mathias Lindner
2011-05-04 06:43:23 UTC
Permalink
Hi,

I've posted this already in the German newsgroup but without any answer
and it's kind of urgent...

Have you ever experienced that colors from xcolor are not quite correct?
At the moment I have just looked at the TFT (no print) but with several
PDF viewers.
I set a color with RGB (e.g. with \textcolor). But it looks different
than how GIMP shows this color or how Gnuplot uses this color in his
diagrams. Since two independent tool behave equal and differ from xcolor
I guess xcolor is wrong here.

The problem is that I want to set some Text in the same color I have
used in Gnuplot diagrams.

Minimal example - not very useful since the comparison is missing - but
maybe someone has GIMP or Gnuplot ;)
\documentclass{scrartcl}
\usepackage{xcolor}
\begin{document}
\textcolor[RGB]{0,90,70}{Test}
\end{document}

Cheers,
Mathias
Christoph Bersch
2011-05-04 07:51:30 UTC
Permalink
Post by Mathias Lindner
Have you ever experienced that colors from xcolor are not quite correct?
At the moment I have just looked at the TFT (no print) but with several
PDF viewers.
I set a color with RGB (e.g. with \textcolor). But it looks different
than how GIMP shows this color or how Gnuplot uses this color in his
diagrams. Since two independent tool behave equal and differ from xcolor
I guess xcolor is wrong here.
I tested your example (changed the Text):

I compiled the example

\documentclass{scrartcl}
\usepackage{xcolor}
\begin{document}
\textcolor[RGB]{0,90,70}{\rule{1cm}{1cm}}
\end{document}

imported this to gimp and with the color picker tool I confirmed, that
the color is correct. Also I do not see a difference between the pdf in
any viewer and a rectangle drawn in gimp.

But what I also noticed before is, that the same color looks much
different when used with CM font compared to bolder lines from diagrams
although nominally the colors are equal.

Christoph
Heiko Oberdiek
2011-05-04 08:31:33 UTC
Permalink
Post by Christoph Bersch
But what I also noticed before is, that the same color looks much
different when used with CM font compared to bolder lines from diagrams
although nominally the colors are equal.
Perhaps antialiasing effects?
--
Heiko Oberdiek
GL
2011-05-04 08:11:54 UTC
Permalink
Post by Mathias Lindner
Hi,
I've posted this already in the German newsgroup but without any answer
and it's kind of urgent...
There is a problem with transparency and I found a hack looking on
google:
\pdfpageattr{/Group <</S /Transparency /I true /CS /DeviceRGB>>}

for pdfTeX.
Post by Mathias Lindner
Have you ever experienced that colors from xcolor are not quite correct?
At the moment I have just looked at the TFT (no print) but with several
PDF viewers.
I set a color with RGB (e.g. with \textcolor). But it looks different
than how GIMP shows this color or how Gnuplot uses this color in his
diagrams. Since two independent tool behave equal and differ from xcolor
I guess xcolor is wrong here.
The problem is that I want to set some Text in the same color I have
used in Gnuplot diagrams.
Minimal example - not very useful since the comparison is missing - but
maybe someone has GIMP or Gnuplot ;)
\documentclass{scrartcl}
\usepackage{xcolor}
\begin{document}
\textcolor[RGB]{0,90,70}{Test}
\end{document}
Cheers,
Mathias
Heiko Oberdiek
2011-05-04 08:27:02 UTC
Permalink
Post by Mathias Lindner
Have you ever experienced that colors from xcolor are not quite correct?
At the moment I have just looked at the TFT (no print) but with several
PDF viewers.
I set a color with RGB (e.g. with \textcolor). But it looks different
than how GIMP shows this color or how Gnuplot uses this color in his
diagrams. Since two independent tool behave equal and differ from xcolor
I guess xcolor is wrong here.
The problem is that I want to set some Text in the same color I have
used in Gnuplot diagrams.
Minimal example - not very useful since the comparison is missing - but
maybe someone has GIMP or Gnuplot ;)
\documentclass{scrartcl}
\usepackage{xcolor}
\begin{document}
\textcolor[RGB]{0,90,70}{Test}
\end{document}
I can't reproduce the problem.
Package xcolor has to convert the RGB values to rgb, the
result in the PDF file (pdflatex):
0 0.35294 0.2745
(That's the result of division by 255).

I have generated a PNG graphics with gimp using
RGB (0,90,70), included it in the test file and
processed it via Ghostscript in ppm.
In both cases the colors were RGB(0, 90, 70).

Perhaps you can complete the minimal example
by a simple gnuplot script and a small graphics
(a rectangle filled with the color) and the
PDF result somewhere for download.
--
Heiko Oberdiek
Mathias Lindner
2011-05-05 09:22:41 UTC
Permalink
Post by Heiko Oberdiek
Post by Mathias Lindner
Have you ever experienced that colors from xcolor are not quite correct?
At the moment I have just looked at the TFT (no print) but with several
PDF viewers.
I set a color with RGB (e.g. with \textcolor). But it looks different
than how GIMP shows this color or how Gnuplot uses this color in his
diagrams. Since two independent tool behave equal and differ from xcolor
I guess xcolor is wrong here.
The problem is that I want to set some Text in the same color I have
used in Gnuplot diagrams.
Minimal example - not very useful since the comparison is missing - but
maybe someone has GIMP or Gnuplot ;)
\documentclass{scrartcl}
\usepackage{xcolor}
\begin{document}
\textcolor[RGB]{0,90,70}{Test}
\end{document}
I can't reproduce the problem.
Package xcolor has to convert the RGB values to rgb, the
0 0.35294 0.2745
(That's the result of division by 255).
I have generated a PNG graphics with gimp using
RGB (0,90,70), included it in the test file and
processed it via Ghostscript in ppm.
In both cases the colors were RGB(0, 90, 70).
Perhaps you can complete the minimal example
by a simple gnuplot script and a small graphics
(a rectangle filled with the color) and the
PDF result somewhere for download.
Thanks for your answers! I guess I found the reason for this problem. Try:

\documentclass{scrartcl}

\usepackage[cmyk]{xcolor}
\usepackage[shell,miktex]{gnuplottex} %delete miktex if you are under Linux
\usepackage{epstopdf}

\begin{document}

\begin{gnuplot}[terminal=epslatex, terminaloptions=color]
set ylabel '\textcolor[HTML]{005A46}{Test}'

plot sin(x) lw 5 lc rgb '#005a46'
\end{gnuplot}
\end{document}


Now you should see the difference between graph and label color.

Everything is fine as long as the cmyk option is not passed to xcolor.
But the class I need (baposter) loads xcolor automatically with cmyk
since it's going to be printed. Seems like the conversion is handled not
quite fine.

Now the question: is there something wrong with xcolor - then how can I
work around it? Or is my workflow wrong - then how should I change it :)

Thanks again!
Mathias
Heiko Oberdiek
2011-05-05 09:44:21 UTC
Permalink
Post by Mathias Lindner
\usepackage[cmyk]{xcolor}
\usepackage[shell,miktex]{gnuplottex} %delete miktex if you are under Linux
\usepackage{epstopdf}
\begin{document}
\begin{gnuplot}[terminal=epslatex, terminaloptions=color]
set ylabel '\textcolor[HTML]{005A46}{Test}'
plot sin(x) lw 5 lc rgb '#005a46'
\end{gnuplot}
\end{document}
Now you should see the difference between graph and label color.
Everything is fine as long as the cmyk option is not passed to xcolor.
Then you have two different programs that convert RGB to cmyk,
xcolor and the PDF viewer. Because these conversion is not
trivial and can be done in different ways, different colors are not
too surprising.

I don't see any sense in option `cmyk', because there are RGB colors
that are not seen by xcolor. The option can be overriden later by
\selectcolormodel{natural}
(see package documentation of `xcolor').
--
Heiko Oberdiek
Mathias Lindner
2011-05-05 14:26:40 UTC
Permalink
Post by Heiko Oberdiek
Post by Mathias Lindner
\usepackage[cmyk]{xcolor}
\usepackage[shell,miktex]{gnuplottex} %delete miktex if you are under Linux
\usepackage{epstopdf}
\begin{document}
\begin{gnuplot}[terminal=epslatex, terminaloptions=color]
set ylabel '\textcolor[HTML]{005A46}{Test}'
plot sin(x) lw 5 lc rgb '#005a46'
\end{gnuplot}
\end{document}
Now you should see the difference between graph and label color.
Everything is fine as long as the cmyk option is not passed to xcolor.
Then you have two different programs that convert RGB to cmyk,
xcolor and the PDF viewer. Because these conversion is not
trivial and can be done in different ways, different colors are not
too surprising.
I don't see any sense in option `cmyk', because there are RGB colors
that are not seen by xcolor. The option can be overriden later by
\selectcolormodel{natural}
(see package documentation of `xcolor').
Wonderful, exactly what I needed.

It somehow seemed obvious to use cmyk for a job mainly supposed to be
printed. But you are right, there are RGB colors anyway in the document
so I can just work in RGB at all...

Cheers,
Mathias

Continue reading on narkive:
Loading...