PygmentsCodeFences—how to choose themes?

Hi guys,

I’m trying to make a coding tricks blog with Hugo, and I got Pygments so I can do syntax highlighting with blocks like this:

def hello object
  puts "Hello, #{object}"

This “works” in that the code is colored, but the colors aren’t good (white text on white background). Is there a way to change the theme of the highlighting?

In config:

pygmentsstyle: "trac"

See pygments doc for available themes.

1 Like

Thanks! Eventually I got it to work with this:


PygmentsCodeFences = true
PygmentsStyle = "monokai"

For a list of styles and what they look like, is the best link I’ve found.

For the background of code blocks, actually this is set by the Hugo theme, for the Hyde theme I was using I needed to override the css like this:


pre {
  background-color: #333;
code {
  background-color: #EEE

And add the link to override.css to /themes/hyde/layouts/partials/head.html

Hope this helps others!