Merge pull request #5670 from gsouquet/fix/is-on-dark-theme

Update isUserOnDarkTheme to take use_system_theme in account
pull/21833/head
J. Ryan Stinnett 2021-02-22 17:29:49 +00:00 committed by GitHub
commit e30a0d6420
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 4 deletions

View File

@ -103,11 +103,15 @@ export default class UserMenu extends React.Component<IProps, IState> {
};
private isUserOnDarkTheme(): boolean {
const theme = SettingsStore.getValue("theme");
if (theme.startsWith("custom-")) {
return getCustomTheme(theme.substring("custom-".length)).is_dark;
if (SettingsStore.getValue("use_system_theme")) {
return window.matchMedia("(prefers-color-scheme: dark)").matches;
} else {
const theme = SettingsStore.getValue("theme");
if (theme.startsWith("custom-")) {
return getCustomTheme(theme.substring("custom-".length)).is_dark;
}
return theme === "dark";
}
return theme === "dark";
}
private onProfileUpdate = async () => {