Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

onboarding: Fix theme picker always updating theme based on system appearance (#47245)

Michael Hackner6ab03c6c1f17
diff --git a/crates/onboarding/src/basics_page.rs b/crates/onboarding/src/basics_page.rs
index b5a2f5de365..b683b137438 100644
--- a/crates/onboarding/src/basics_page.rs
+++ b/crates/onboarding/src/basics_page.rs
@@ -209,8 +209,8 @@ fn render_theme_section(tab_index: &mut isize, cx: &mut App) -> impl IntoElement
) {
let fs = <dyn Fs>::global(cx);
let theme = theme.into();
- update_settings_file(fs, cx, move |settings, cx| {
- if theme_mode == ThemeAppearanceMode::System {
+ update_settings_file(fs, cx, move |settings, cx| match theme_mode {
+ ThemeAppearanceMode::System => {
let (light_theme, dark_theme) =
get_theme_family_themes(&theme).unwrap_or((theme.as_ref(), theme.as_ref()));
@@ -219,10 +219,19 @@ fn render_theme_section(tab_index: &mut isize, cx: &mut App) -> impl IntoElement
light: ThemeName(light_theme.into()),
dark: ThemeName(dark_theme.into()),
});
- } else {
- let appearance = *SystemAppearance::global(cx);
- theme::set_theme(settings, theme, appearance, appearance);
}
+ ThemeAppearanceMode::Light => theme::set_theme(
+ settings,
+ theme,
+ Appearance::Light,
+ *SystemAppearance::global(cx),
+ ),
+ ThemeAppearanceMode::Dark => theme::set_theme(
+ settings,
+ theme,
+ Appearance::Dark,
+ *SystemAppearance::global(cx),
+ ),
});
}
}