Revert "Remove cx from ThemeSettings (#38836)" (#39691)

This reverts commit a2a7bd139a.

This caused themes to not load correctly on startup, you needed to edit
your settings.

Release Notes:

- N/A
This commit is contained in:
Conrad Irwin
2025-10-07 15:45:20 +00:00
committed by GitHub
parent e765818487
commit 41cf114d8a
60 changed files with 423 additions and 360 deletions
+10 -2
View File
@@ -34,8 +34,16 @@ fn get_theme_family_themes(theme_name: &str) -> Option<(&'static str, &'static s
}
fn render_theme_section(tab_index: &mut isize, cx: &mut App) -> impl IntoElement {
let theme_selection = ThemeSettings::get_global(cx).theme.clone();
let theme_selection = ThemeSettings::get_global(cx).theme_selection.clone();
let system_appearance = theme::SystemAppearance::global(cx);
let theme_selection = theme_selection.unwrap_or_else(|| ThemeSelection::Dynamic {
mode: match *system_appearance {
Appearance::Light => ThemeMode::Light,
Appearance::Dark => ThemeMode::Dark,
},
light: ThemeName("One Light".into()),
dark: ThemeName("One Dark".into()),
});
let theme_mode = theme_selection
.mode()
@@ -103,7 +111,7 @@ fn render_theme_section(tab_index: &mut isize, cx: &mut App) -> impl IntoElement
ThemeMode::Dark => Appearance::Dark,
ThemeMode::System => *system_appearance,
};
let current_theme_name: SharedString = theme_selection.name(appearance).0.into();
let current_theme_name = SharedString::new(theme_selection.theme(appearance));
let theme_names = match appearance {
Appearance::Light => LIGHT_THEMES,