5  Color

In contrast to style sheets which affect only the HTML output, the commands \color and \definecolor may be used to specify text color for both HTML and DVI output. These commands are provided by the standard LaTeX package color.sty, and are also defined in tex2page.tex for use with plain TeX.

\color[color-model]{color-spec

specifies that the rest of the text in the current group should be in the color given by color-spec using color-model.

color-model is one of rgb, cmyk, gray, RGB, or named, and may be omitted (with the brackets) if it is named. The color-spec for the model gray is a number between 0 and 1 (inclusive); for rgb, a comma-separated list of three numbers, all between 0 and 1; for cmyk, a list of four numbers, all between 0 and 1; for RGB, a list of three integers, all between 0 and 255 (inclusive); and for named, a pre- or user-defined color name.

Eg:

{\color[gray]{.17} light gray}, 
{\color[rgb]{.69, .19, .38} maroon}, 
{\color[cmyk]{0, .89, .94, .28} brick red}, 
{\color[RGB]{220, 20, 60} crimson}, 
{\color[named]{magenta} magenta}, and 
{\color{blue} blue}. 

produces:

light gray, maroon, brick red, crimson, magenta, and blue.

Predefined color names are red, blue, green, cyan, magenta, yellow, black, and white. New color names can be defined by:

\definecolor{new-color-name}{color-model}{color-spec

Eg:

\definecolor{BrickRed}{cmyk}{0, .89, .94, .28} 

Most color-capable browsers support the very large list of named colors in the X11 file rgb.txt. In order for your printed document to have access to these same color names, definitions for them are provided in the TeX macro file x11rgb.tex, included in the TeX2page distribution.

cmyk definitions for the 68 standard DVIPS color names are available in the standard LaTeX macro file dvipsnam.def. These are not predefined by browsers, so you will need to load dvipsnam.def explicitly if your HTML document is to benefit from them. For plain TeX documents, load dvipsnam.def after loading tex2page.tex.