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.
-
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']
-
Check out the demo for various styles
- 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
- Replace the current pygments.css with the new one
$ cp pygments_monokai.css pygments.css
That's it. Now just deploy and push.