mirror of
https://github.com/thegeeklab/hugo-geekblog.git
synced 2024-11-24 22:10:39 +00:00
fix: dont write color mode defaults to local storage (#345)
This commit is contained in:
parent
fde18f0ef2
commit
b67e883eff
@ -7,7 +7,7 @@ document.addEventListener("DOMContentLoaded", (event) => {
|
||||
|
||||
colorThemeToggle.onclick = function () {
|
||||
let lstore = Storage.namespace(THEME)
|
||||
let currentColorTheme = lstore.get("color-theme")
|
||||
let currentColorTheme = lstore.get("color-theme") || COLOR_THEME_AUTO
|
||||
let nextColorTheme = toggle(TOGGLE_COLOR_THEMES, currentColorTheme)
|
||||
|
||||
lstore.set("color-theme", TOGGLE_COLOR_THEMES[nextColorTheme])
|
||||
@ -25,7 +25,6 @@ export function applyTheme(init = true) {
|
||||
: COLOR_THEME_AUTO
|
||||
|
||||
html.setAttribute("class", "color-toggle-" + currentColorTheme)
|
||||
lstore.set("color-theme", currentColorTheme)
|
||||
|
||||
if (currentColorTheme === COLOR_THEME_AUTO) {
|
||||
html.removeAttribute("color-theme")
|
||||
|
@ -3,7 +3,7 @@ const { COLOR_THEME_DARK, THEME, COLOR_THEME_AUTO } = require("./config.js")
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function (event) {
|
||||
let lstore = Storage.namespace(THEME)
|
||||
let currentColorTheme = lstore.get("color-theme")
|
||||
let currentColorTheme = lstore.get("color-theme") || COLOR_THEME_AUTO
|
||||
let darkModeQuery = window.matchMedia("(prefers-color-scheme: dark)")
|
||||
let darkMode = false
|
||||
let theme = "default"
|
||||
|
Loading…
Reference in New Issue
Block a user