Skip to content

Commit

Permalink
fix: dont write color mode defaults to local storage (#528)
Browse files Browse the repository at this point in the history
  • Loading branch information
xoxys authored Nov 2, 2022
1 parent 128a55e commit d0a7f2b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/js/colorTheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand All @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion src/js/mermaid.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 currentMode = lstore.get("color-theme")
let currentMode = lstore.get("color-theme") || COLOR_THEME_AUTO
let darkModeQuery = window.matchMedia("(prefers-color-scheme: dark)")
let darkMode = false
let theme = "default"
Expand Down

0 comments on commit d0a7f2b

Please sign in to comment.