Skip to content

Commit

Permalink
fix theme switcher
Browse files Browse the repository at this point in the history
  • Loading branch information
ZsharE committed Aug 22, 2024
1 parent b447bb3 commit aa083ca
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ window.addEventListener('load', function() {
function setTheme(mode) {
if (mode) {
localStorage.setItem('bs-theme', mode);
document.documentElement.setAttribute('data-bs-theme', mode === 'light' || 'darkmode');
document.documentElement.setAttribute('data-bs-theme', mode === 'light' ? 'light' : 'darkmode');
document.querySelectorAll('button#toggle-theme i').forEach((i) => i.classList.add('d-none'));
}
const modeInverse = localStorage.getItem('bs-theme') === 'light' ? 'dark' : 'light';
Expand Down
2 changes: 1 addition & 1 deletion assets/js/main.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/main.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion default.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<script>
const theme = localStorage.getItem("bs-theme") || "light";
localStorage.setItem("bs-theme", theme);
document.documentElement.setAttribute('data-bs-theme', theme === 'light' || 'darkmode');
document.documentElement.setAttribute('data-bs-theme', theme === 'light' ? 'light' : 'darkmode');
</script>

<nav class="navbar navbar-expand-md navbar-dark bg-dark sticky-top">
Expand Down

0 comments on commit aa083ca

Please sign in to comment.