mirror of
https://github.com/bunny-lab-io/Borealis.git
synced 2025-07-27 12:48:29 -06:00
Removed the Requirement to Install Python and NodeJS (Now Bundled with Borealis)
This commit is contained in:
24
Dependencies/Python/Doc/html/_static/themetoggle.js
vendored
Normal file
24
Dependencies/Python/Doc/html/_static/themetoggle.js
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
const pydocthemeDark = document.getElementById('pydoctheme_dark_css')
|
||||
const pygmentsDark = document.getElementById('pygments_dark_css')
|
||||
const themeSelectors = document.getElementsByClassName('theme-selector')
|
||||
|
||||
function activateTheme(theme) {
|
||||
localStorage.setItem('currentTheme', theme);
|
||||
[...themeSelectors].forEach(e => e.value = theme)
|
||||
switch (theme) {
|
||||
case 'light':
|
||||
pydocthemeDark.media = 'not all'
|
||||
pygmentsDark.media = 'not all'
|
||||
break;
|
||||
case 'dark':
|
||||
pydocthemeDark.media = 'all'
|
||||
pygmentsDark.media = 'all'
|
||||
break;
|
||||
default:
|
||||
// auto
|
||||
pydocthemeDark.media = '(prefers-color-scheme: dark)'
|
||||
pygmentsDark.media = '(prefers-color-scheme: dark)'
|
||||
}
|
||||
}
|
||||
|
||||
activateTheme(localStorage.getItem('currentTheme') || 'auto')
|
Reference in New Issue
Block a user