HEAD PREVIOUS

10  Color

TTH supports the coloring of text using the color package macros for LATEX, supported by dvips (but not xdvi). TTH also supports the Plain TEX colordvi macros contained in the package colordvi.tex that do the same thing.

10.1  LATEX Color

The LATEX syntax is recommended because the 68 standard named colors7 are directly supported internally by TTH using the named model. Any numerical CMYK, RGB and Gray color can also be prescribed. For example the following commands are enclosed in themselves: \textcolor[named]{BrickRed}{...}, \textcolor[rgb]{0.,.5,0.}{...}, \textcolor[cmyk]{0.,.5,0.,0.3}{...}. You can define custom colors in the usual way using, for example
{\definecolor{Puce}{rgb}{1.,.5,.8}
\color{Puce} This is my own Puce.}

Which gives " This is my own Puce."
The command \pagecolor is supported but discouraged. It is highly likely to give rise to an HTML file that will fail validation because it inserts an HTML tag <body bgcolor=...> which will not be in its correct position (immediately following the title). The only way to be certain to produce an HTML file that passes validation is to put the title and body commands in by hand, using e.g. \special{html:<title>...</title><body ...>} Netscape seems not to mind a body tag out of order, but only the first one is able to set the page background color.
The commands \colorbox and \fcolorbox are supported via CSS style sheet commands. They will only work to set the background color of included text if the browser is set to use style sheets. "This sentence" is the result of the command \colorbox{green}{``This sentence''}. If it is colored, then your browser supports style sheets to this extent. If not, check your preferences settings.

10.2  Plain Color

The Plain TEX syntax using commands such as \Red{red text} requires the file colordvi.tex to be input prior to their use. But because TTH does not search the standard TEX paths, that file will not usually be found unless the full path is explicitly specified. If the file is not found, only the 8 standard colors
\Red, \Green, \Blue, \Cyan, \Magenta, \Yellow, \Black, and \White

are recognized internally by TTH. You can use the user-defined CMYK numeric style
\Color{0. .5 .5 0.}{pale red}

without the colordvi file. It gives the result "pale red" but the notation becomes cumbersome unless you define your color e.g. like
\def\redcolor{0. .5 .5 0.}
\Color{\redcolor}{The stuff that is red.}

Another difficulty with the colordvi command \textColor (which is the color switch - LATEX syntax reversed that usage and changed to comma-delimited arguments just to confuse us) is that it is a global setting. It then becomes almost impossible to maintain proper nesting of the closure of the font commands used for colors in HTML. As a result, use of \textColor often gives HTML files that won't pass HTML validation.

10.3  Limitations

Color commands do not propagate into different cells of HTML tables because of what may be regarded as a browser bug [13.5]. For that reason, tables and equations will not color correctly if the color commands enclose more than one cell (for tables) or equation element. Remember also that some computers may be limited in their color display capability, so the subtleties of colors will be lost in some circumstances.

HEAD NEXT