Skip to content

Commit

Permalink
add event to watch media change
Browse files Browse the repository at this point in the history
  • Loading branch information
mohdali committed Oct 13, 2023
1 parent 8ce224c commit e4a17ca
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/mohdali.github.io/wwwroot/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ window.setTheme = () => {
}
}

document.addEventListener("DOMContentLoaded", () => {
window.addEventListener("DOMContentLoaded", () => {
setTheme();
});
});

window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
setTheme();
})

0 comments on commit e4a17ca

Please sign in to comment.