anurag.foo

Change Chroma syntax highlight in Hugo

· Anurag Upadhaya

You can explore all the Chroma themes at Chroma Playground

To change Chroma syntax highlighting for your theme:

  1. Make Hugo use classes instead of inline styles
1[markup]
2  [markup.highlight]
3    noclasses = false
  1. Generate new Chroma stylesheets
1hugo gen chromastyles --style=monokai > layouts/partials/css/syntax-dark.css

Based on your theme, you can either have this new stylesheet load through <link> or through css media queries.

Sources:

https://aamnah.com/notes/hugo/hugo-custom-chroma-syntax-highlighting/ https://bwiggs.com/posts/2021-08-03-hugo-syntax-highlight-dark-light/

#hugo #til

Reply to this post by email ↪