4  Color and style

You can have your HTML output use style sheets [402733]. The command

\inputcss basic.css 

in your TeX source will cause the HTML output to use the presentation advice contained in the style sheet basic.css. The \inputcss command has no relevance for the DVI output.

In the style sheet, you can have rules for the various HTML elements to change the appearance of your document. Eg,

h1      {color: navy} 

will cause all top-level headers to be navy-blue. You can get finer control on the look of your document by defining rules for some classes that are peculiar to TeX2page. These special classes are discussed in this manual alongside the commands that they govern (sections 5.4 and 5.5).

You can have as many \inputcss's in your document as you wish. They will be combined in the sequence in which they appear. It is perhaps necessary to add that style sheets are completely optional.

You can also embed style sheet information in the TeX source between the control sequences \cssblock and \endcssblock. Eg,

\cssblock 
h1      {color: navy} 
\endcssblock 

You can have multiple \cssblocks in the document; they are all evaluated in sequence.

The TeX2page distribution includes the file css.t2p, which contains a sample \cssblock that focuses on style rules for the TeX2page-specific classes. It may be modified, or combined with other more general styles such as the W3C Core Styles [41] (which can be included with \inputcss).

4.1  Changing text 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.