Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit bce88ef

Browse files
author
Germain
committed
update isUserOnDarkTheme to return correct theme when use_system_theme is true
Signed-off-by: Germain <[email protected]>
1 parent a794bfd commit bce88ef

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/components/structures/UserMenu.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,15 @@ export default class UserMenu extends React.Component<IProps, IState> {
103103
};
104104

105105
private isUserOnDarkTheme(): boolean {
106-
const theme = SettingsStore.getValue("theme");
107-
if (theme.startsWith("custom-")) {
108-
return getCustomTheme(theme.substring("custom-".length)).is_dark;
106+
if (SettingsStore.getValue("use_system_theme")) {
107+
return window.matchMedia("(prefers-color-scheme: dark)").matches;
108+
} else {
109+
const theme = SettingsStore.getValue("theme");
110+
if (theme.startsWith("custom-")) {
111+
return getCustomTheme(theme.substring("custom-".length)).is_dark;
112+
}
113+
return theme === "dark";
109114
}
110-
return theme === "dark";
111115
}
112116

113117
private onProfileUpdate = async () => {

0 commit comments

Comments
 (0)