Change Chroma syntax highlight in Hugo
You can explore all the Chroma themes at Chroma Playground
To change Chroma syntax highlighting for your theme:
- Make Hugo use classes instead of inline styles
1[markup]
2 [markup.highlight]
3 noclasses = false
- 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/