 |
Department of Engineering |
 |
 |
Next: Special characters
Up: Color and Fonts
Previous: Color and Fonts
Commands that control foreground and background
colors need
\usepackage[dvips]{color}
after the \documentclass line but before \begin{document}.
\textcolor{colorname}{text}
writes text in a color which can be specified by name (black, white,
red, green, blue or a color name you've defined), RGB components,
or grayscale.
\colorbox{colorname}{text}
writes text in a box with a colored background.
\fcolorbox{framecolor}{boxcolor}{text}
writes text in a colored frame.
\pagecolor{colorname} sets the color
of the page's background.
\definecolor{colorname}{color specification} lets you define new color names.
\definecolor{gold}{rgb}{0.85,.66,0}
This is in \textcolor{red}{red} and this box is \colorbox{gold}{gold}.
Text color can be set using RGB values
(\textcolor[rgb]{0,1,0}{like so}), or \textcolor[gray]{0.2}{shades}
\textcolor[gray]{0.5}{of} \textcolor[gray]{0.8}{grey}.
produces
This is in red and this box is .
Text color can be set using RGB values
(like so), or shades
of grey.