- 论坛徽章:
- 0
|
24 All about colors
Beamer handles colors with the help of an external facility called xcolor8. Beamer loads xcolor by default; you don't need to load it explicitly. This makes the following named colors available:
![]()
Named colors from the dvips package
Xcolor can read an extended set of color names from the file /usr/share/texmf/tex/latex/graphics/dvipsnam.def
To make this extended set available to Beamer, invoke Beamer as:
\documentclass[xcolor=dvipsnames]{beamer}
Here is what the extended color set looks like:
![]()
Named colors from the SVG package
Xcolor can read an even a larger set of color names from the file9 /usr/local/share/texmf/tex/latex/xcolor/svgnam.def
To make this extended set available to Beamer, invoke Beamer as:
\documentclass[xcolor=svgnames]{beamer}
Here is what the SVG color set looks like:
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.)
![]()
See the xcolor documentation for more details.10
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.11
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}
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.
8 Xcolor's author is Uwe Kern. See http://www.ukern.de/tex/xcolor.html.
9 The file svgnam.def is distributed with xcolor.
10 On the department's machine you may view the documentation by doing:
gv /usr/local/share/texmf/doc/latex/xcolor/xcolor.PS &
11 The color package is loaded by Beamer by default. You don't need to load it separately. |
|