davidhampgonsalves / hugo-black-and-light-theme

A High contrast, text oriented, performant and Javascript-free theme for Hugo.
https://themes.gohugo.io/themes/hugo-black-and-light-theme/
GNU General Public License v3.0
188 stars 94 forks source link

Syntax Highlighting with Dark Theme #28

Open angles-n-daemons opened 1 year ago

angles-n-daemons commented 1 year ago

Hi there, I'm seeing a similar issue to #14.

I've added the recommended fix and although syntax highlighting is working now, the background color has changed in code blocks with syntax applied in a way that makes the code unreadable:

image

I should note that code blocks without a syntax specified still view fine:

image

Are there any recommendations as to how to approach this issue? I'm unfamiliar with how hugo themes work, but I'm happy to investigate further on my end.

angles-n-daemons commented 1 year ago

For the broken section, the style is applied outside of a stylesheet:

from developer tools:

// no file
element.style {
    background-color: #fff;
    ...
}

whereas for the working section the style is applied by the stylesheet:


// (index):392
@media (prefers-color-scheme: dark)
pre, code {
    background-color: #262626;
}
angles-n-daemons commented 1 year ago

Codebase to reproduce:

https://github.com/angles-n-daemons/angles-n-daemons.github.io/tree/bdillmann/popsql-1

angles-n-daemons commented 1 year ago

Seems like removing pygmentsStyle="colorful" from the config.toml addresses this issue though I'm not sure why