Patch light mode pygments to remove hardcoded background

Both dark and light mode now use theme CSS variables for backgrounds
This commit is contained in:
Russell Ballestrini 2025-10-13 12:01:56 -04:00
parent 05c9f19913
commit 04ccdcd881

View file

@ -55,6 +55,7 @@ pygments:
@echo "Generating pygments stylesheets..." @echo "Generating pygments stylesheets..."
venv/bin/python -c "from pygments.formatters import HtmlFormatter; print(HtmlFormatter(style='monokai').get_style_defs('.highlight'))" > pelican-themes/pelican-svbhack/static/css/pygments-dark.css venv/bin/python -c "from pygments.formatters import HtmlFormatter; print(HtmlFormatter(style='monokai').get_style_defs('.highlight'))" > pelican-themes/pelican-svbhack/static/css/pygments-dark.css
venv/bin/python -c "from pygments.formatters import HtmlFormatter; print(HtmlFormatter(style='default').get_style_defs('.highlight'))" > pelican-themes/pelican-svbhack/static/css/pygments-light.css venv/bin/python -c "from pygments.formatters import HtmlFormatter; print(HtmlFormatter(style='default').get_style_defs('.highlight'))" > pelican-themes/pelican-svbhack/static/css/pygments-light.css
@echo "Patching dark mode to remove hardcoded background..." @echo "Patching to remove hardcoded backgrounds..."
sed -i 's/.highlight { background: #272822; color: #f8f8f2 }/.highlight { color: #f8f8f2 }/' pelican-themes/pelican-svbhack/static/css/pygments-dark.css sed -i 's/.highlight { background: #272822; color: #f8f8f2 }/.highlight { color: #f8f8f2 }/' pelican-themes/pelican-svbhack/static/css/pygments-dark.css
sed -i 's/.highlight { background: #f8f8f8; }/.highlight { }/' pelican-themes/pelican-svbhack/static/css/pygments-light.css
@echo "Done! Pygments stylesheets generated and patched." @echo "Done! Pygments stylesheets generated and patched."