diff --git a/templates/partial/flex.html b/templates/partial/flex.html
index 3099ec7..8843889 100644
--- a/templates/partial/flex.html
+++ b/templates/partial/flex.html
@@ -20,11 +20,13 @@
if (theme === 'browser') {
theme = darkSchemeWatch.matches ? 'dark' : 'light';
}
+ console.log(`Switching theme to ${theme}.`)
+
+ // Find the pygments CSS file and change it to the theme specified in the
+ // config.
const pygmentsTheme = theme === 'light'
? '{{ PYGMENTS_STYLE }}'
: '{{ PYGMENTS_STYLE_DARK or PYGMENTS_STYLE }}'
- console.log(`Switching theme to ${theme}.`)
-
Array.from(document.head.getElementsByTagName('link')).forEach(linkEl => {
if (linkEl.href.match(/\/theme\/pygments\/.*\.min\.css/)) {
linkEl.href = `/theme/pygments/${pygmentsTheme}.min.css`;
@@ -32,11 +34,11 @@
});
if (theme === 'dark') {
- document.body.classList.add('dark_theme');
- document.body.classList.remove('light_theme');
+ document.body.classList.add('dark-theme');
+ document.body.classList.remove('light-theme');
} else {
- document.body.classList.add('light_theme');
- document.body.classList.remove('dark_theme');
+ document.body.classList.add('light-theme');
+ document.body.classList.remove('dark-theme');
}
}