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

Michael Hackner , Claude Opus 4.5 , and MrSubidubi created

The settings store separate themes for Light and Dark modes. When the
user clicks a theme, the code uses the system appearance to decide which
to update, rather than the mode the user selected in the UI. This causes
the wrong theme to be saved when the system appearance differs from the
selected mode.

<img width="746" height="324" alt="image"
src="https://github.com/user-attachments/assets/b8f8d937-172d-4da8-b572-4f3db7f1de9a"
/>

Release Notes:

- Fixed onboarding page sometimes rendering the wrong theme

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: MrSubidubi <finn@zed.dev>

Change summary

crates/onboarding/src/basics_page.rs | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)

Detailed changes

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),
+            ),
         });
     }
 }