8

I noticed that 25% opacity with a white background yields a different result for me than mixing 75% white into the color. Why is that, and what would be the correct way to not have opacity but the identical colour (at least for a white background).

Here a MWE:

\documentclass[xcolor=dvipsnames]{article}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}

\draw[ black!25!white,fill=RoyalBlue!25!white] (0.0,0) circle (0.7cm);

\draw[opacity=0.25, fill=RoyalBlue] (3,0) circle (0.7cm);

\end{tikzpicture}

\end{document}

resulting image

  • 4
    This depends on the default blend mode. Transparency blend is not equal to color mixins. Hence it is natural that they don't match. See the manual for the blend modes. – percusse Jul 31 '15 at 12:32
2

The fastest way to fix it is to replace dvipsnames by svgnames.


Comment by percusse is roughly right. The actual problem is, RoyalBlue in dvipsnames is defined using CMYK model. While we expect linear interpolation in color blending, CMYK model is handled, according to PDF standard, by the following:

  • The C, M, and Y components shall be converted to their complementary R, G, and B components in the usual way. The preceding formulas shall be applied to the RGB colour values. The results shall be converted back to C, M, and Y.
  • For the K component, the result shall be the K component of Cb for the Hue, Saturation, and Color blend modes; it shall be the K component of Cs for the Luminosity blend mode.

(Cb = background color; Cs = source color)

This shows that in general a blending involving CMYK is never linear unless the K components are the same.

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.