fix: more bad references
This commit is contained in:
parent
3bd71a6acc
commit
ac005e6d13
1 changed files with 5 additions and 4 deletions
|
@ -89,18 +89,19 @@
|
||||||
<script>
|
<script>
|
||||||
(() => {
|
(() => {
|
||||||
const currentTheme = sessionStorage?.getItem('theme');
|
const currentTheme = sessionStorage?.getItem('theme');
|
||||||
if (!currentTheme) sessionStorage?.setItem('theme', (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'))
|
const prefersDarkScheme = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
||||||
|
if (!currentTheme) sessionStorage?.setItem('theme', (prefersDarkScheme ? 'dark' : 'light'))
|
||||||
if (currentTheme === 'dark') {
|
if (currentTheme === 'dark') {
|
||||||
document.body.classList.add('theme__dark')
|
document.body.classList.add('theme__dark')
|
||||||
} else if (currentTheme === 'light') {
|
} else if (currentTheme === 'light') {
|
||||||
document.body.classList.add('theme__light')
|
document.body.classList.add('theme__light')
|
||||||
} else if (this.prefersDarkScheme) {
|
} else if (prefersDarkScheme) {
|
||||||
document.body.classList.add('theme__dark')
|
document.body.classList.add('theme__dark')
|
||||||
} else if (!this.prefersDarkScheme) {
|
} else if (!prefersDarkScheme) {
|
||||||
document.body.classList.add('theme__light')
|
document.body.classList.add('theme__light')
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
{{ content }}
|
{{ content }}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Reference in a new issue