I defined a syntax highlighting for my code like so:
\lstdefinelanguage{CSharp}{
sensitive = true,
keywords={assembly, class, method, field},
keywords=[2]{public, private, family, assembly, famandassem, famorassem, nested, static, abstract, virtual, hidebysig, cil, managed, specialname, rtspecialname, interface, sealed, auto, ansi, unicode, beforefieldinit, sequential, explicit},
keywords=[3]{class, void, string, int, object, if, else, if, switch, break, case, boo, while, truel},
keywordstyle=\color{forestgreen},
keywordstyle=[2]\color{purple},
keywordstyle=[3]\color{blue},
numbers=left,
numberstyle=\scriptsize,
stepnumber=1,
numbersep=8pt,
xleftmargin=2em,
framexleftmargin=1.5em,
showstringspaces=false,
breaklines=true,
frame=single,
basicstyle=\ttfamily,
comment=[l]{//},
morecomment=[s]{/*}{*/},
commentstyle=\color{forestgreen},
stringstyle=\color{maroon},
morestring=[b]',
morestring=[b]"
}
\definecolor{forestgreen}{rgb}{0.13, 0.55, 0.13}
\definecolor{maroon}{rgb}{0.5, 0.0, 0.0}
\newcommand{\sourcecode}[3]{\vspace{10pt}\lstinputlisting[language=CSharp, label={#2}, caption={#3}, captionpos=b, abovecaptionskip=10pt]{#1}}
It works nicely but I can't change the colors of numbers in the code. When I add them to the keyword list they are simply ignored. And modifying the numberstyle only affects the line numbers but not the numbers in the code:
How can I set custom color highlighting for numbers in the code, such as the 0 and the 3?

\documentclasscommand, include any necessary packages and be as small as possible to demonstrate your problem. At the moment we have to guess what packages etc you are using before we can compile your code. – Jun 22 '19 at 00:30