No need to throw here

This commit is contained in:
RMidhunSuresh 2022-06-14 19:27:18 +05:30
parent 69d8e6031e
commit d00ea39dc4
1 changed files with 1 additions and 2 deletions

View File

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