# change font color in a lstset

Hi I need put java code to latex. I use \lstset and \begin{lstlisting}. I need change color of font in SOME part of code. How I can do this? Help pls

-
Do you want to change the color of some keywords or do you want to highlight some code lines? It would help us if you provide a little example... – Matten Dec 8 '10 at 13:45

Here is an example of settings. Please modify as you wish for your language:

\lstnewenvironment{teX}[1][]
{\lstset{language=[LaTeX]TeX}\lstset{escapeinside={(*@}{@*)},
numbers=left,numberstyle=\normalsize,stepnumber=1,numbersep=5pt,
%firstnumber=last,
%frame=tblr,
framesep=5pt,
basicstyle=\normalsize\ttfamily,
showstringspaces=false,
keywordstyle=\itshape\color{blue},
%identifierstyle=\ttfamily,
stringstyle=\color{maroon},
rulecolor=\color{Gray},
xleftmargin=5pt,
xrightmargin=5pt,
aboveskip=\bigskipamount,
belowskip=\bigskipamount,
backgroundcolor=\color{LightGray!.50}, #1
}}
{}


I personally find it easier to define environments for lstlistings rather than using the other style commands (saves time on typing).