How to change the color of the numbers in the python code block to blue, but at the same time leave the numbers in the comment block green?
Also, for the keyword network3
. How to just change that keyword "network3" to blue, but leave "network3" as black in `network3.load_data_shared()"?
Here is the code:
\documentclass[a4paper, 10pt, oneside, fleqn, openright]{report}
\usepackage[no-math]{fontspec}
\usepackage{calc}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage{pdfpages,graphicx}
\usepackage{mdframed}
\usepackage{listings}
\definecolor{light-gray}{gray}{0.92}
\definecolor{mainColor}{RGB}{211, 47, 47} % some dark red
\renewcommand\lstlistingname{Python Code}
\lstdefinestyle{pycode}{
language=Python,
numbers=left,
numbersep= 7mm,
numberstyle=\color{Black},
stepnumber=1,
tabsize=3,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
basicstyle=\color{Black}\ttfamily,
commentstyle=\color{LimeGreen},
stringstyle=\color{WildStrawberry},
frame=leftline,
framesep=0mm,
xleftmargin=3mm,
framesep=2mm,
framerule=0mm,
abovecaptionskip=5mm,
aboveskip=\baselineskip,
belowskip=\baselineskip,
basicstyle=\ttfamily\scriptsize,
classoffset=1,
morekeywords={var, func, extends, import, as,from},
keywordstyle=\color{BurntOrange}\bfseries,
classoffset=2,
morekeywords={network3},
keywordstyle=\color{blue}\bfseries,
}
\usepackage{tcolorbox}
\tcbuselibrary{skins,breakable,listings}
\begin{document}
\begin{lstlisting}[style=pycode]
"""
===============
Many plot types can be combined in one figure to create
powerful and flexible representations of data.
10 is not colored.
"""
import network3
from network3 import Network
from network3 import ConvPoolLayer, FullyConnectedLayer, SoftmaxLayer
training_data, validation_data, test_data = network3.load_data_shared()
mini_batch_size = 10
net = Network([
FullyConnectedLayer(n_in=784, n_out=100),
SoftmaxLayer(n_in=100, n_out=10)], mini_batch_size)
net.SGD(training_data, 60, mini_batch_size, 0.1, validation_data, test_data)
\end{lstlisting}
\end{document}