Add a couple comments
This commit is contained in:
parent
91aa9016e7
commit
6816d4800b
1 changed files with 8 additions and 6 deletions
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue