mirror of
https://github.com/lifegpc/eh-downloader.git
synced 2026-07-08 01:31:00 +08:00
add Lisntener to prefers-color-scheme
This commit is contained in:
@@ -2,3 +2,11 @@ export function detect_darkmode() {
|
||||
return window.matchMedia &&
|
||||
window.matchMedia("(prefers-color-scheme: dark)").matches;
|
||||
}
|
||||
|
||||
export function addDarkModeListener(e: (e: MediaQueryListEvent) => void) {
|
||||
return window.matchMedia &&
|
||||
window.matchMedia("(prefers-color-scheme: dark)").addEventListener(
|
||||
"change",
|
||||
e,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user