In [9]:
from pygments.formatters import HtmlFormatter
from pygments.style import Style
from pygments.token import Keyword, Name, Comment, String, Error, \
     Number, Operator, Generic, Whitespace, Punctuation, Other, Literal

In [19]:
class OldFashionedStyle(Style):
    background_color = '#fff'
    default_style = ''
    
    styles= {
        Whitespace: 'underline #f8f8f8'
    }

In [20]:
print(HtmlFormatter(style=OldFashionedStyle).get_style_defs())


.hll { background-color: #ffffcc }
.w { color: #f8f8f8; text-decoration: underline } /* Text.Whitespace */

In [ ]: