5.16 PDF Colors

By default, URLs and cross-reference links are printed in black in PDF output. Very occasionally, however, you may want to highlight such “live” links with a different color, as is commonly done on web pages. Texinfo provides a PDF-specific option for specifying these colors, which must be used inside @tex:

@tex
\global\def\linkcolor{1 0 0}  % red
\global\def\urlcolor{0 1 0}   % green
@end tex

\urlcolor changes the color of @url output (both the actual URL and any textual label), while \linkcolor changes the color for cross-references to nodes, etc. They are independent.

The three given values must be numbers between 0 and 1, specifying the amount of red, green, and blue respectively.

These definitions only have an effect when the PDF output is produced with the pdfTeX program, not with other ways of getting from Texinfo to PDF (e.g., TeX to DVI to PDF). Consequently, it is ok to specify this option unconditionally within @tex, as shown above. It is ignored when DVI is being produced.

We do not recommend colorizing just for fun; unless you have a specific reason to use colors, best to skip it.