RGB code for predefined colors

You can let xcolor show you the numbers:

\documentclass{article}
\usepackage[dvipsnames]{xcolor}
\begin{document}
\convertcolorspec{named}{RoyalBlue}{RGB}\tmp

RGB of Royalblue is: \tmp

\end{document}

enter image description here


Although Ulrike's answer does provide you with RGB numbers, it's worth adding that the colours in dvipsnames are actually defined in CMYK. You can find the definitions in dvipsnam.def, which gives:

\DefineNamedColor{named}{Periwinkle}    {cmyk}{0.57,0.55,0,0}
\DefineNamedColor{named}{PineGreen}     {cmyk}{0.92,0,0.59,0.25}
\DefineNamedColor{named}{RoyalBlue}     {cmyk}{1,0.50,0,0}

This is important because the RGB values returned by xcolor use a very simplistic conversion formula.

So if you use those RGB values to create new colours and then make a PDF they won't look the same.

For more predictable results, you must use a conversion tool that is able to do colour managed conversions using ICC profiles. e.g.,

% Converted from CMYK to RGB using:
% CMYK Profile: ISOcoated_v2_eci.icc
% RGB Profile: sRGB_v4_ICC_preference.icc
% I did this using Scribus, but any colour managed application will do
\definecolor{Managed-Periwinkle}{RGB}{130,120,183}
\definecolor{Managed-PineGreen}{RGB}{0,131,108}
\definecolor{Managed-RoyalBlue}{RGB}{0,104,180}

You may still notice a difference in how your PDF viewer renders the CMYK colours and the Managed RGB colours I've specified, but this is because it's probably using different colour profiles for the conversion from CMYK to RGB to display the CMYK colours on screen.

Consider this MWE:

\documentclass{article}

\usepackage{booktabs}
\usepackage[dvipsnames]{xcolor}

% Converted from CMYK to RGB using:
% CMYK Profile: ISOcoated_v2_eci.icc
% RGB Profile: sRGB_v4_ICC_preference.icc
% I did this using Scribus, but any colour managed application will do
\definecolor{Managed-Periwinkle}{RGB}{130,120,183}
\definecolor{Managed-PineGreen}{RGB}{0,131,108}
\definecolor{Managed-RoyalBlue}{RGB}{0,104,180}

\newcommand{\col}[1]{%
  \textcolor{#1}{\vrule width 1cm}}

\begin{document}

\convertcolorspec{named}{Periwinkle}{RGB}\tmp
\definecolor{RGB-Periwinkle}{RGB}{\tmp}

\convertcolorspec{named}{PineGreen}{RGB}\tmp
\definecolor{RGB-PineGreen}{RGB}{\tmp}

\convertcolorspec{named}{RoyalBlue}{RGB}\tmp
\definecolor{RGB-RoyalBlue}{RGB}{\tmp}

\begin{tabular}{@{}llll@{}}
  \toprule
  & CMYK & \texttt{xcolor} RGB & Managed RGB \\
  \midrule
  Periwinkle & \col{Periwinkle} & \col{RGB-Periwinkle} & \col{Managed-Periwinkle} \\
  PineGreen & \col{PineGreen} & \col{RGB-PineGreen} & \col{Managed-PineGreen} \\
  RoyalBlue & \col{RoyalBlue} & \col{RGB-RoyalBlue} & \col{Managed-RoyalBlue} \\
  \bottomrule
\end{tabular}

\end{document}

MWE output

Tags:

Color