25  All about colors

Beamer handles colors with the help of a LaTeX package called xcolor10. Beamer loads xcolor by default; you don’t need to load it explicitly. This makes the following named colors available:

[image]

Named colors from the dvips package

Xcolor can read an extended set of color names from the file dvipsnam.def which is supplied with many LaTeX distributions.

To make this extended set available to Beamer, invoke Beamer as:

\documentclass[xcolor=dvipsnames]{beamer} 

Here is what the extended color set looks like:

[image]

Named colors from the SVG package

Xcolor can read an even larger set of color names from the file11 svgnam.def which is supplied with many LaTeX distributions.

To make this extended set available to Beamer, invoke Beamer as:

\documentclass[xcolor=svgnames]{beamer} 

Here is what the SVG color set looks like:

[image]

A few of the SVG names are duplicates: Aqua = Cyan, Fuchsia = Magenta, Gray = Grey, DarkGray = DarkGrey, LightGray = LightGrey, SlateGray = SlateGrey, DarkSlateGray = DarkSlateGrey, LightSlateGray = LightSlateGrey, DimGray = DimGrey.

Blending colors

The xcolor package provides a means to mix any set of colors in desired proportions, just as you would mix colors in a paint store.

We specify a mix consisting of n percent from color A and (100-n) percent from color B as A!n!B. The expression A!n!B may be used wherever a color name is expected in Beamer. The expression A!n is a shorthand for A!n!white. Here are a few samples. (Read each row from left to right.)

[image]

See the xcolor documentation for more details.12

Defining your own colors

In addition to the mechanisms described in the previous sections, you may define colors using the \definecolor command, as documented in the LaTeX manual and made available by loading the color package.13

You specify a color by giving its RGB (Red Green Blue) components as decimal fractions in the interval 0 to 1 to \definecolor, as in:

\definecolor{mygold}{rgb}{0.85, 0.60, 0.00}  % note the lowercase RGB 

Alternatively, you may specify the RGB components as integer values in the range 0 to 255, as in:

\definecolor{mygold}{RGB}{217, 153, 0}       % note the uppercase RGB 

Then “mygold” may be used as any other color in LaTeX or Beamer. For instance:

This sentence is printed in “mygold”.

This sentence is printed in “green!15!mygold”.

See Colored text, highlights and boxes on how to use colors in your Beamer documents.



10 Xcolor’s author is Uwe Kern. See http://www.ukern.de/tex/xcolor.html.

11 The file svgnam.def is distributed with xcolor.

12 On the department’s machine you may view the documentation by doing:

    gv  /usr/local/share/texmf/doc/latex/xcolor/xcolor.PS &

13 The color package is loaded by Beamer by default. You don’t need to load it separately.