Skip to content

Commit

Permalink
format and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ntonnaett committed May 6, 2024
1 parent 20ef29a commit 86c6887
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/utils/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,23 @@ export function initTheme() {
darkModeToggle.addEventListener("click", () => {
toggleDarkMode();
});
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
if (event.matches) {
darkModeOn();
} else {
darkModeOff();
};
});
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
window
.matchMedia("(prefers-color-scheme: dark)")
.addEventListener("change", (event) => {
if (event.matches) {
darkModeOn();
} else {
darkModeOff();
}
});
if (
window.matchMedia &&
window.matchMedia("(prefers-color-scheme: dark)").matches
) {
darkModeOn();
} else {
darkModeOff();
};
}
}

/**
Expand Down

0 comments on commit 86c6887

Please sign in to comment.