Change Syntax Highlights with Pygments CSS for Pelican Site

It's important to get the syntax highlight colors right. Here's my workflow to update that when I feel like a change.

  1. Find out which themes are already available from pygments

    >>> from pygments.styles import STYLE_MAP
    >>> STYLE_MAP.keys()
    ['monokai', 'manni', 'rrt', 'perldoc', 'borland', 'colorful', 'default', 'murphy', 'vs', 'trac', 'tango', 'fruity', 'autumn', 'bw', 'emacs', 'vim', 'pastie', 'friendly', 'native']
  2. Check out the demo for various styles

    This site has a good gallery

  3. Generate a new pygments_XXX.css in static/css/ folder under the specific theme directory, based on Pelican's instruction

    $ pygmentize -S vim -f html -a .highlight > pygments_vim.css
  4. Replace the current pygments.css with the new one

    $ cp pygments_monokai.css pygments.css

That's it. Now just deploy and push.

Go Top

If you enjoy reading articles like this, a small donation in ETH will go a long way to make sure I spend enough time working on this. My Ethereum address: 0xae56b1f221a48f3dbbaaea110b049d5c1aba6efe.

<< Workflow For an Aspiring Stock Photographer Using Lightroom and Symbiostock on Self-hosted Wordpress Site
>> How To Share Files and Photos Without Any Cloud Service