Skip to content

Commit

Permalink
Fix auto darkmode is overwritten by light mode
Browse files Browse the repository at this point in the history
  • Loading branch information
MG-5 committed Nov 7, 2023
1 parent 6c9d166 commit 31665b6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion assets/js/main.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions assets/js/partials/dark-mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ window.onload = function bootstrapTheme() {
if (!currentTheme()) {
// Load browser's preference
let browserPrefersDark = window.matchMedia('(prefers-color-scheme: dark)');
if (browserPrefersDark.matches) sessionStorage.setItem('theme', 'dark');
browserPrefersDark.addEventListener('change', () => {
if (browserPrefersDark.matches) sessionStorage.setItem('theme', 'dark')
});
Expand Down

0 comments on commit 31665b6

Please sign in to comment.