No need to throw here

This commit is contained in:
RMidhunSuresh 2022-06-14 19:27:18 +05:30
parent 69d8e6031e
commit d00ea39dc4

View file

@ -196,13 +196,12 @@ export class ThemeLoader {
}
}
get preferredColorScheme(): ColorSchemePreference {
get preferredColorScheme(): ColorSchemePreference | undefined {
if (window.matchMedia("(prefers-color-scheme: dark)").matches) {
return ColorSchemePreference.Dark;
}
else if (window.matchMedia("(prefers-color-scheme: light)").matches) {
return ColorSchemePreference.Light;
}
throw new Error("Cannot find preferred colorscheme!");
}
}