# Why lstlisting does not highlight numbers?

I would like to include some python code in my document, and here is what I have written so far:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage[spanish]{babel}
\usepackage{listings}
\usepackage{xcolor}

\definecolor{codegreen}{rgb}{0.04314,0.6745,0.07843}
\definecolor{codegray}{rgb}{0.7059,0.6863,0.702}
\definecolor{codered}{rgb}{0.5373,0.02745,0.06275}
\definecolor{codeblue}{rgb}{0.071,0.0258,0.9882}
\definecolor{codepurple}{rgb}{0.6,0.02745,0.5961}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}

\lstdefinestyle{mystyle}{
keywordstyle=\color{codepurple},
otherkeywords={range, print, max, len},
classoffset=1, % starting new class
keywordstyle=\color{codeblue},
numberstyle=\color{codered},
stringstyle=\color{codegreen},
basicstyle=\ttfamily,
showspaces=false,
showstringspaces=false,
}

\lstset{style=mystyle}

\begin{document}
\begin{lstlisting}[language=Python]
sd.play(audio.astype('int16'))

paso = 5
for i in range(0,ntramas,paso):
\end{lstlisting}
\end{document}


I would want the code to appear like this:

However, this is what I get in latex:

The difference is in the colour of numbers, which appear in black despite I have indicated with the numberstyle sentence I want them in red.

• Doesn't numberstyle refer to line numbers as opposed to numbers inside of the code? Dec 21 '19 at 12:28
• I thought numberstyle was for numbers, but you are totally right. My apologies and thank you Dec 21 '19 at 12:36