Add another color at other keywords in listings
Since you want to customize (La)TeX, it's a good idea to set texcsstyle
to have the same color as the keywords and to use the star so that the backslash will also have the same color; regarding your issue, the braces are not really keywords; I set their style (and also for the square brackets) using literate
(notice the *
character in the first literate line to prevent color form appearing in comments and strings):
\documentclass{scrreprt}
\usepackage{listings}
\usepackage[dvipsnames]{xcolor}
\definecolor{keywords}{HTML}{8A4A0B}
\definecolor{background}{HTML}{EEEEEE}
\definecolor{comments}{HTML}{868686}
\definecolor{myblue}{RGB}{20,105,176}
\lstset{language=[LaTeX]Tex,
keywordstyle=\color{keywords},
texcsstyle=*\color{keywords},
basicstyle=\normalfont\ttfamily,
commentstyle=\color{comments}\ttfamily,
stringstyle=\rmfamily,
numbers=left,
numberstyle=\scriptsize,
stepnumber=1,
numbersep=8pt,
showstringspaces=false,
breaklines=true,
frameround=ftff,
frame=lines,
morekeywords={RequirePackage,ProvidesPackage,NeedsTeXFormat},
backgroundcolor=\color{background},
literate=
*{\{}{{\textcolor{myblue}{\{}}}{1}
{\}}{{\textcolor{myblue}{\}}}}{1}
{[}{{\textcolor{myblue}{[}}}{1}
{]}{{\textcolor{myblue}{]}}}{1},
}
\begin{document}
\begin{lstlisting}[firstnumber=1]
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{arsclassica}[2012/02/21 v4.0 Customizing ClassicThesis (LP)]
\RequirePackage{classicthesis}
\RequirePackage{caption}% Caption package
\end{lstlisting}
\end{document}
To answer your specific question, you can use [<number>]
both in keywordstyle
and in keywords
, to define different keyword sets with their own style; a little example
\documentclass{scrreprt}
\usepackage{listings}
\usepackage[dvipsnames]{xcolor}
\definecolor{keywords}{HTML}{8A4A0B}
\definecolor{background}{HTML}{EEEEEE}
\lstset{language=[LaTeX]Tex,
keywordstyle=\color{keywords},
keywordstyle=[2]\color{red},
keywordstyle=[3]\color{orange},
basicstyle=\normalfont\ttfamily,
showstringspaces=false,
frameround=ftff,
frame=lines,
morekeywords={RequirePackage,ProvidesPackage},
keywords=[2]{Some,Other,Keywords},
keywords=[3]{and,another,test},
backgroundcolor=\color{background}
}
\begin{document}
\begin{lstlisting}[firstnumber=1]
\NeedsTeXFormat{LaTeX2e}
Some Other Keywords
and another test
\end{lstlisting}
\end{document}
To apply color to lengths, one can escape to LaTeX (this however won't work for in-line listings):
\documentclass{scrreprt}
\usepackage{listings}
\usepackage[dvipsnames]{xcolor}
\definecolor{keywords}{HTML}{8A4A0B}
\definecolor{background}{HTML}{EEEEEE}
\definecolor{comments}{HTML}{868686}
\definecolor{lengthcolor}{RGB}{200,40,150}
\definecolor{myblue}{RGB}{20,105,176}
\lstset{language=[LaTeX]Tex,
keywordstyle=\color{keywords},
texcsstyle=*\color{keywords},
basicstyle=\normalfont\ttfamily,
commentstyle=\color{comments}\ttfamily,
stringstyle=\rmfamily,
numbers=left,
numberstyle=\scriptsize,
stepnumber=1,
numbersep=8pt,
showstringspaces=false,
breaklines=true,
frameround=ftff,
frame=lines,
morekeywords={RequirePackage,ProvidesPackage,NeedsTeXFormat,setlength},
backgroundcolor=\color{background},
literate=
*{\{}{{{\color{myblue}{\{}}}}{1}
{\}}{{{\color{myblue}{\}}}}}{1}
{[}{{{\color{myblue}{[}}}}{1}
{]}{{{\color{myblue}{]}}}}{1},
escapeinside=!!
}
\newcommand\lencolor[1]{\textcolor{lengthcolor}{\texttt{#1}}}
\begin{document}
\begin{lstlisting}[firstnumber=1]
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{arsclassica}[2012/02/21 v4.0 Customizing ClassicThesis (LP)]
\RequirePackage{classicthesis}
\RequirePackage{caption}% Caption package
\setlength\parskip{!\lencolor{18pt}!}
\hspace*{!\lencolor{15cm}!}
\end{lstlisting}
\end{document}