Skip to content

Commit

Permalink
fix the theme switcher
Browse files Browse the repository at this point in the history
  • Loading branch information
hry-gh committed Aug 20, 2024
1 parent 73b4ba8 commit ebfe5c3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion static/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const handleNavClick = (event) => {
}

const handleThemeSwitch = (event) => {
const newTheme = document.getElementById("root").classList.contains(THEME_CLASS_DARK) ? THEME_CLASS_LIGHT : THEME_CLASS_DARK
const newTheme = document.documentElement.classList.contains(THEME_CLASS_DARK) ? THEME_CLASS_LIGHT : THEME_CLASS_DARK
localStorage.setItem(LOCAL_STORAGE_KEY_THEME, newTheme)
setTheme()
}
Expand Down
2 changes: 1 addition & 1 deletion templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
</head>

<body id="root" class="safe-h-screen">
<script>
<script type="text/javascript">
const LOCAL_STORAGE_KEY_THEME = "ref-theme"

const THEME_VALUE_AUTO = "auto"
Expand Down

0 comments on commit ebfe5c3

Please sign in to comment.