mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 17:07:07 +00:00
dark_theme: Add automatic color scheme support for spectators.
Similar to the light/dark theme support for the spectators, this adds the automatic color scheme support by storing the user's preference in the local storage.
This commit is contained in:
@@ -27,4 +27,10 @@ export function disable(): void {
|
||||
|
||||
export function default_preference_checker(): void {
|
||||
$(":root").removeClass("dark-theme").addClass("color-scheme-automatic");
|
||||
|
||||
if (page_params.is_spectator) {
|
||||
const ls = localstorage();
|
||||
ls.set("spectator-theme-preference", "automatic");
|
||||
user_settings.color_scheme = settings_config.color_scheme_values.automatic.code;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -429,6 +429,8 @@ export function initialize_everything(state_data) {
|
||||
dark_theme.enable();
|
||||
} else if (preferred_theme === "light") {
|
||||
dark_theme.disable();
|
||||
} else {
|
||||
dark_theme.default_preference_checker();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user