chore: update user setting appearance (#654)

This commit is contained in:
boojack
2022-12-02 20:00:34 +08:00
committed by GitHub
parent 5451fd2d2c
commit 14f9f29348
17 changed files with 134 additions and 159 deletions

View File

@ -140,3 +140,11 @@ export function absolutifyLink(rel: string): string {
anchor.setAttribute("href", rel);
return anchor.href;
}
export function getSystemColorScheme() {
if (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) {
return "dark";
} else {
return "light";
}
}