\listfiles
\documentclass{jarticle}
\usepackage{verbatim,framed}
\usepackage{color}

\newenvironment{colorverbatim}[1][CornflowerBlue]%
{%
  \definecolor{shadecolor}{named}{#1}%
% supress ugly vertical space which is inserted by
% environment above and below text:
  \topsep=0ex\relax
% start shaded and verbatim:
  \shaded
  \verbatim
}%
{%
  \endverbatim
  \endshaded
}%

\newenvironment{colorverbatim*}[1][CornflowerBlue]%
{%
  \definecolor{shadecolor}{named}{#1}%
% supress ugly vertical space which is inserted by
% environment above and below text:
  \topsep=0ex\relax
% start shaded and verbatim:
  \shaded
  \csname verbatim*\endcsname
}%
{%
  \csname endverbatim*\endcsname
  \endshaded
}%

\begin{document}

\begin{colorverbatim}
This is verbatim
\@nil -> \TeX is funny!
\end{colorverbatim}

\begin{colorverbatim}[Lavender]
This is verbatim
\@nil -> \TeX is funny!
\end{colorverbatim}

\begin{colorverbatim*}
This is verbatim*
\@nil -> \TeX is funny!
\end{colorverbatim*}

\begin{colorverbatim*}[Lavender]
This is verbatim*
\@nil -> \TeX is funny!
\end{colorverbatim*}

\end{document}

from comp.text.tex
