PGF/TikZ Manual

The TikZ and PGF Packages
Manual for version 3.1.10


91 Extended Color Support

This section documents the package xxcolor, which is currently distributed as part of pgf. This package extends the xcolor package, written by Uwe Kern, which in turn extends the color package. I hope that the commands in xxcolor will some day migrate to xcolor, such that this package becomes superfluous.

The main aim of the xxcolor package is to provide an environment inside which all colors are “washed out” or “dimmed”. This is useful in numerous situations and must typically be achieved in a roundabout manner if such an environment is not available.

  • \begin{colormixin}{mix-in specification}

  • environment contents

  • \end{colormixin}

  • The mix-in specification is applied to all colors inside the environment. At the beginning of the environment, the mix-in is applied to the current color, i.e., the color that was in effect before the environment started. A mix-in specification is a number between 0 and 100 followed by an exclamation mark and a color name. When a \color command is encountered inside a mix-in environment, the number states what percentage of the desired color should be used. The rest is “filled up” with the color given in the mix-in specification. Thus, a mix-in specification like 90!blue will mix in 10% of blue into everything, whereas 25!white will make everything nearly white.


    \usepackage {xxcolor}
    \color{red}Red text,%
    washed-out red text,
    \color{blue} washed-out blue text,
    dark washed-out blue text,
    \color{green} dark washed-out green text,%
    back to washed-out blue text,%
    and back to red.

Note that the environment only changes colors that have been installed using the standard \color command. In particular, the colors in images are not changed. There is, however, some support offered by the commands \pgfuseimage and \pgfuseshading. If the first command is invoked inside a colormixin environment with the parameter, say, 50!black on an image with the name foo, the command will first check whether there is also a defined image with the name foo.!50!black. If so, this image is used instead. This allows you to provide a different image for this case. If you nest colormixin environments, the different mix-ins are all appended. For example, inside the inner environment of the above example, \pgfuseimage{foo} would first check whether there exists an image named foo.!25!white!25!black.