Currently, my listings use this style :
\definecolor{lstgrey}{RGB}{217, 217, 217}
\definecolor{lstback}{RGB}{246, 246, 246}
\newlength{\numberlengthnormal}
\setlength{\numberlengthnormal}{\widthof{\fontfamily{cmtt}\selectfont 999}}
\setlength{\numberlengthnormal}{0.25\numberlengthnormal}
\lstnewenvironment{lstcpp}
{\lstset{%
language = C++,
tabsize=2,
basicstyle=\fontfamily{cmtt}\selectfont,
keywordstyle=\color{blue},
commentstyle=\color{green},
morekeywords={constexpr, kind, parameter, allocatable},
showstringspaces = false,
backgroundcolor=\color{lstback},
numbers = left,
numbersep = 2\numberlengthnormal,
xleftmargin = 6\numberlengthnormal,
}}%
How to color the background of numbers as in the following example ?