Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I fail to understand the color mixing of xcolor.

I want to have a lighter and a darker version of a color defined as

\definecolor{BlueLUH}{cmyk}{1.0,0.7,0,0}

My approach of lighter and darker is this one

\colorlet{LightBlue}{BlueLUH!20!white}
\colorlet{DarkBlue}{BlueLUH!80!black!20}

which according to the docs is replaced internally to

\colorlet{LightBlue}{BlueLUH!20!white!white}
\colorlet{DarkBlue}{BlueLUH!80!black!20!white}

Now I wonder what is actually calulated, bcause I get the same for Light and Dark, as can be seen in the following screenshot: enter image description here

share|improve this question
    
I think white is only taken as default color if there is no second color, so: BlueLUH!20 is taken as BlueLUH!20!white, while BlueLUH!20!white will stay as it is and not taken as BlueLUH!20!white!white. But I could be wrong, of course. –  Martin Scharrer Nov 15 '11 at 12:48
    
@MartinScharrer: that would make sence. Nevertheless how is it calulated? Blue*0.8 + black*0.2 + 1.0*white or blue*1.0+black*0.8+white*0.2 or even different? –  Matthias Pospiech Nov 15 '11 at 13:36
add comment

1 Answer 1

up vote 8 down vote accepted

That are different colors, but cannot be seen! 20% of black is less than light gray! Compare it with a 40% of black! The values for the cmyk color can easily be seen in the pdf output when using \pdfcompresslevel=0.

The colors are calculated as:

enter image description here

\pdfcompresslevel=0
\documentclass{article}
\usepackage[cmyk]{xcolor}

\definecolor{BlueLUH}{cmyk}{1.0,0.7,0,0}
\colorlet{LightBlue}{BlueLUH!20!white}
\colorlet{DarkBlue}{BlueLUH!80!black!20}
%\colorlet{LightBlue}{BlueLUH!20!white!white}
%\colorlet{DarkBlue}{BlueLUH!80!black!20!white}

\begin{document} 

\color{BlueLUH}\rule{1cm}{1cm}
\color{LightBlue}\rule{1cm}{1cm}
\color{DarkBlue}\rule{1cm}{1cm}

\color[cmyk]{1, 0.7, 0, 0}\rule{1cm}{1cm} 
\color[cmyk]{0.2, 0.14, 0, 0}\rule{1cm}{1cm}
\color[cmyk]{0.16, 0.112, 0, 0.04}\rule{1cm}{1cm}

\colorlet{DarkBlue}{BlueLUH!80!black!40}
\color{BlueLUH}\rule{1cm}{1cm}
\color{LightBlue}\rule{1cm}{1cm}
\color{DarkBlue}\rule{1cm}{1cm}

\end{document}

enter image description here

share|improve this answer
    
It is correct that they are not equal, but they are so close that the eye can not distinguish between them. Unfortunately this does not tell me how to get darker colors using colormixing with xcolor. –  Matthias Pospiech Nov 15 '11 at 13:34
    
from which document are these formulas? i can not find them within the xcolor package. I understand how red!75 is calculated with eqn (1), but the calculation of red!75!blue!100 does not seems to be relatd to eqn (1). At least something in the calculation was left out, since eqn (1) does not mention how more than one color is combined. –  Matthias Pospiech Nov 16 '11 at 9:10
    
(1) is a loop, as already mentioned ... and it is my text from my book ... :-) –  Herbert Nov 16 '11 at 10:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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