IDVI User's Guide

Back to the table of contents.

Using Color

There are two ways of using color with idvi. First, you can use the color options to the idvi command. These control the text colors used for your whole document, and also allow you to set a background color other than white. Second, you can use the color push and color pop \specials, either directly or via the colordvi package. These allow you to change the color of just a part of your document, such as the header or footer.

Color Names

The following colors may be referred to by name in the color options to idvi in the color push \special, and when using the colordvi package.

GreenYellow, Yellow, Goldenrod, Dandelion, Apricot, Peach, Melon, YellowOrange, Orange, BurntOrange, Bittersweet, RedOrange, Mahogany, Maroon, BrickRed, Red, OrangeRed, RubineRed, WildStrawberry, Salmon, CarnationPink, Magenta, VioletRed, Rhodamine, Mulberry, RedViolet, Fuchsia, Lavender, Thistle, Orchid, DarkOrchid, Purple, Plum, Violet, RoyalPurple, BlueViolet, Periwinkle, CadetBlue, CornflowerBlue, MidnightBlue, NavyBlue, RoyalBlue, Blue, Cerulean, Cyan, ProcessBlue, SkyBlue, Turquoise, TealBlue, Aquamarine, BlueGreen, Emerald, JungleGreen, SeaGreen, Green, ForestGreen, PineGreen, LimeGreen, YellowGreen, SpringGreen, OliveGreen, RawSienna, Sepia, Brown, Tan, Gray, Black, (White).

Color Options

The color options to idvi apply to your whole document. Use these in the same way that you would use the color attributes of the <body> tag, to set the foreground and background colors used to display all of the text in your document.

The argument to each option may be either a color name or a red-green-blue triple of the form #RRGGBB.

-backgroundColor <color>
(default White)
Background color.

-foregroundColor <color>
(default Black)
Color used for plain text.

-linkColor <color>
(default #0000EE)
Color used for the text of links.

-selectedLinkColor <color>
(default Red)
Color used for the text of links while they are being selected by the user.

Color \specials

The color push and color pop \specials are supported. Use these when you wish to change the color of just a part of your document, such as the header or footer.

The color push and color pop \specials must appear in balanced pairs, and a run of colored text may not cross a page boundary.

The argument to the color push \special is either a color name or a list of component values between 0.0 and 1.0. The Red-Green-Blue and Cyan-Magenta-Yellow-blacK component systems are supported. For example,

\special{color push JungleGreen}
Green text,
\special{color pop}

\special{color push rgb .01 1 .48}
more green text,
\special{color pop}

\special{color push cmyk .99 0 .52 0}
and yet more green text.
\special{color pop}

The colordvi Package

The colordvi package defines macros which make it easier to use the color push and color pop \specials. Colors may be specified either by color name or by Cyan-Magenta-Yellow-blacK component values. Using the colordvi package, the example above becomes
\JungleGreen{Green text,} 

\Color{.99 0 .52 0}{and yet more green text.}
In addition to producing the color push and color pop \specials, the colordvi package ensures that only the desired text changes color. Using the \specials directly as in the first example, you may have trouble with item numbers or equation numbers changing color unexpectedly. The colordvi package solves this problem by automatically bracketting all item numbers and equation numbers with color push Black and color pop \specials.

To use the colordvi package, add a \usepackage line after the \documentclass line at the start of your document:

\documentclass[10pt]{article}
\usepackage{colordvi}
If your LaTeX source starts with a \documentstyle declaration, add colordvi to the list of style options instead:
\documentstyle[10pt,colordvi]{article}

Using Color Options and the colordvi Package Together

If you use both the -foregroundColor option and the colordvi package, then you must let the colordvi package know what the foreground color will be. This allows it to properly set the color of item numbers and equation numbers. Otherwise, they will appear in black instead of the foreground color.

Use the \textColorName or \textColor{} commands to let colordvi know what foreground color you are using. For example, if you are using the command

idvi -foregroundColor TealBlue \
     mypaper.dvi
Then your document should contain the command \textTealBlue near the beginning:
\begin{document}
\textTealBlue
...

Using Color with the hyperref Package

The hyperref package uses the color package, which is incompatible with the colordvi package. Thus if you follow the directions for Including Links in Your Documents, you will not be able to use the colordvi package as described above.

Back to the table of contents.