Skip to main content

Change Syntax Highlights with Pygments CSS for Pelican Site

· One min read

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

  1. 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
  1. Replace the current pygments.css with the new one
	$ cp pygments_monokai.css pygments.css

That's it. Now just deploy and push.