%%
%%  The LaTeX Graphics Companion, 2ed (first printing May 2007)
%%
%%  Example D-11-3 on page .
%%
%%  Copyright (C) 2007 Michel Goossens, Frank Mittelbach, Denis Roegel, Sebastian Rahtz, Herbert Vo\ss
%%
%%  It may be distributed and/or modified under the conditions
%%  of the LaTeX Project Public License, either version 1.3
%%  of this license or (at your option) any later version.
%%
%%  See http://www.latex-project.org/lppl.txt for details.
%%

\documentclass{ttctexaplate}
\pagestyle{empty}
\setcounter{page}{6}
\setlength\textwidth{413.44133pt}
\StartShownPreambleCommands
\usepackage[dvipsnames]{xcolor}
\StopShownPreambleCommands
\begin{document}
\begin{minipage}{5in}
\setlength\parindent{0pt}
\setlength\parskip{4pt}

{\color{green} Text starts off in green
\textcolor{red}{a little red}
{\color{blue}nested blue text}
returning to green.}

%\hrule

\smallskip
\begin{minipage}{0.4\linewidth}
\begin{enumerate}
\item \textcolor[cmyk]{0,1,0,0}{magenta cmyk} black
\item \color[gray]{0.5}
 \textcolor{blue}{predefined blue} gray text
\end{enumerate}
\end{minipage}\hfill
\begin{minipage}{0.55\linewidth}
\begin{enumerate}\renewcommand\theenumi{\color{red}\roman{enumi}}
\item The \color{.!70}current \color{.!70}color \color{.!70}changes.
\item The \color{.!50}current \color{.!50}color
   \color{.!50}changes.
\end{enumerate}
\end{minipage}

%\hrule

\fcolorbox{red}{green}{Black text,
     green background, red frame}\hfill
\fcolorbox{magenta}{lime}{\color{teal}Teal text,
     lime background, magenta frame}
\par\smallskip
\fcolorbox{red}{green}{\color{white}%
 White text, green background, red frame}\hfill
\fcolorbox{blue}{Orchid}{\color{yellow}%
 Yellow text, orchid background, blue frame}

%\hrule

\setlength{\fboxrule}{6pt}%
\setlength{\fboxsep}{10pt}%
\colorbox{yellow}{Fun with color}
\hfill
\fcolorbox{red}{yellow}{Fun with color}
\hfill
\setlength{\fboxrule}{2pt}%
\setlength{\fboxsep}{5pt}%
\colorbox{green}{Fun with color}
\hfill
\fcolorbox{red}{green}{Fun with color}

%\hrule

\newsavebox{\X}
\sbox{\X}{[black text] and
\color[cmyk]{0,0.6,0.8,0}[orange text]}

Start with \usebox{\X}, and return to black

{\color{green}Start in green, see
\usebox{\X} and once again green}
\end{minipage}
\end{document}