[Tex/LaTex] Are there any pros and cons associated with dvipsnames, svgnames, and x11names in xcolors package

colorpackage-options

The xcolors package mentions three color options in its package documentation at http://mirrors.ctan.org/macros/latex/contrib/xcolor/xcolor.pdf. They are dvipsnames, svgnames, and x11names.

I normally use the dvipsnames option like this:

\usepackage[dvipsnames]{xcolor}

I want to know whether it matters which one of these three options I choose. Is there any obviously preferred option used by most of the LaTeX community or does it just boil down to one's personal preferences?

In other words, to keep this question objective, I want to know if there are any specific pros and cons for each option that we need to be aware of before we decide which option to use with the xcolor package?

Best Answer

One difference is that the colours with dvipsnames are defined in CMYK, but svgnames and x11names are defined in RGB. So you might choose dvipsnames if your final output is intended for offset or digital print.

This difference leads to a potential pitfall to be aware of when using the dvipsnames option of xcolor.

By default pgf shadings are output in RGB, so unless you explicitly ask for CMYK shadings, you won't get the colours you want in shadings. This is especially noticeable when you have the solid colours at either end of the shading, which can sometimes happen in beamer templates.

Consider this MWE demonstrating the issue. Both Blue and LimeGreen are defined by dvipsnames and are in CMYK. The top shading has the wrong colours because it's in RGB. This is what you get unless you explicitly change the colour model to CMYK (e.g., by using \usepackage[cmyk,dvipsnames]{xcolor}).

\documentclass{article}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\begin{document}
\section*{Natural Colour model}

\begin{tikzpicture}
  \fill[Blue] (0,0) rectangle (1,1);
  \shade[left color=Blue, right color=LimeGreen] (1.25,0) rectangle (3.75,1);
  \fill[LimeGreen] (4,0) rectangle (5,1);
\end{tikzpicture}

\section*{CMYK colour model}

\selectcolormodel{cmyk}
\begin{tikzpicture}
  \fill[Blue] (0,0) rectangle (1,1);
  \shade[left color=Blue, right color=LimeGreen] (1.25,0) rectangle (3.75,1);
  \fill[LimeGreen] (4,0) rectangle (5,1);
\end{tikzpicture}
\end{document}

MWE output