mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 22:37:49 +00:00
Fix: don't assume that light mode is active on initial theme switch
This commit is contained in:
@@ -68,8 +68,10 @@ function toc_scroll_position(container) {
|
||||
function toggle_lights() {
|
||||
if (document.documentElement.getAttribute("data-theme") === "dark") {
|
||||
set_theme("light")
|
||||
} else {
|
||||
} else if (document.documentElement.getAttribute("data-theme") === "light") {
|
||||
set_theme("dark")
|
||||
} else {
|
||||
set_theme(window.matchMedia("(prefers-color-scheme: dark)").matches ? "light" : "dark")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user