From 6816d4800bc010eb66901ca125edfeda978a8050 Mon Sep 17 00:00:00 2001 From: Sumner Evans Date: Tue, 7 Apr 2020 22:16:41 -0600 Subject: [PATCH] Add a couple comments --- templates/partial/flex.html | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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'); } }