Fix:Bug: “Static” **color** theme from Dynamic + System mode always used the **dark** slot (#54609)
Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Closes #54607 Release Notes: - Settings UI theme conversion now respects system appearance. When switching Theme Mode from Dynamic (System) to Static, Zed now picks the static theme that matches the current OS app appearance (light or dark) instead of always defaulting to the dark variant. --------- Co-authored-by: Lukas Wirth <lukas@zed.dev>
This commit is contained in:
1 parent
d92c12e86e
commit
cb25ef95f5
5 files changed
+462
-444
No files matched your search
@@ -185,10 +185,11 @@ pub fn render_ollama_model_picker(
|
||||
field.json_path,
|
||||
window,
|
||||
cx,
|
||||
move |settings, _cx| {
|
||||
move |settings, app| {
|
||||
(field.write)(
|
||||
settings,
|
||||
Some(settings::OllamaModelName(model_name.to_string())),
|
||||
app,
|
||||
);
|
||||
},
|
||||
)
|
||||
|
||||
+428
-413
File diff suppressed because it is too large.
Load diff
@@ -121,8 +121,8 @@ fn render_settings_audio_device_dropdown<T: AsRef<Option<String>> + From<Option<
|
||||
field.json_path,
|
||||
window,
|
||||
cx,
|
||||
move |settings, _cx| {
|
||||
(field.write)(settings, value);
|
||||
move |settings, app| {
|
||||
(field.write)(settings, value, app);
|
||||
},
|
||||
)
|
||||
.log_err();
|
||||
|
||||
@@ -5,7 +5,7 @@ use edit_prediction::{
|
||||
open_ai_compatible::{open_ai_compatible_api_token, open_ai_compatible_api_url},
|
||||
};
|
||||
use edit_prediction_ui::{get_available_providers, set_completion_provider};
|
||||
use gpui::{Entity, ScrollHandle, prelude::*};
|
||||
use gpui::{App, Entity, ScrollHandle, prelude::*};
|
||||
use language::language_settings::AllLanguageSettings;
|
||||
|
||||
use settings::Settings as _;
|
||||
@@ -373,7 +373,7 @@ fn ollama_settings() -> Box<[SettingsPageItem]> {
|
||||
.api_url
|
||||
.as_ref()
|
||||
},
|
||||
write: |settings, value| {
|
||||
write: |settings, value, _app: &App| {
|
||||
settings
|
||||
.project
|
||||
.all_languages
|
||||
@@ -406,7 +406,7 @@ fn ollama_settings() -> Box<[SettingsPageItem]> {
|
||||
.model
|
||||
.as_ref()
|
||||
},
|
||||
write: |settings, value| {
|
||||
write: |settings, value, _app: &App| {
|
||||
settings
|
||||
.project
|
||||
.all_languages
|
||||
@@ -439,7 +439,7 @@ fn ollama_settings() -> Box<[SettingsPageItem]> {
|
||||
.prompt_format
|
||||
.as_ref()
|
||||
},
|
||||
write: |settings, value| {
|
||||
write: |settings, value, _app: &App| {
|
||||
settings
|
||||
.project
|
||||
.all_languages
|
||||
@@ -469,7 +469,7 @@ fn ollama_settings() -> Box<[SettingsPageItem]> {
|
||||
.max_output_tokens
|
||||
.as_ref()
|
||||
},
|
||||
write: |settings, value| {
|
||||
write: |settings, value, _app: &App| {
|
||||
settings
|
||||
.project
|
||||
.all_languages
|
||||
@@ -504,7 +504,7 @@ fn open_ai_compatible_settings() -> Box<[SettingsPageItem]> {
|
||||
.api_url
|
||||
.as_ref()
|
||||
},
|
||||
write: |settings, value| {
|
||||
write: |settings, value, _app: &App| {
|
||||
settings
|
||||
.project
|
||||
.all_languages
|
||||
@@ -537,7 +537,7 @@ fn open_ai_compatible_settings() -> Box<[SettingsPageItem]> {
|
||||
.model
|
||||
.as_ref()
|
||||
},
|
||||
write: |settings, value| {
|
||||
write: |settings, value, _app: &App| {
|
||||
settings
|
||||
.project
|
||||
.all_languages
|
||||
@@ -570,7 +570,7 @@ fn open_ai_compatible_settings() -> Box<[SettingsPageItem]> {
|
||||
.prompt_format
|
||||
.as_ref()
|
||||
},
|
||||
write: |settings, value| {
|
||||
write: |settings, value, _app: &App| {
|
||||
settings
|
||||
.project
|
||||
.all_languages
|
||||
@@ -600,7 +600,7 @@ fn open_ai_compatible_settings() -> Box<[SettingsPageItem]> {
|
||||
.max_output_tokens
|
||||
.as_ref()
|
||||
},
|
||||
write: |settings, value| {
|
||||
write: |settings, value, _app: &App| {
|
||||
settings
|
||||
.project
|
||||
.all_languages
|
||||
@@ -635,7 +635,7 @@ fn codestral_settings() -> Box<[SettingsPageItem]> {
|
||||
.api_url
|
||||
.as_ref()
|
||||
},
|
||||
write: |settings, value| {
|
||||
write: |settings, value, _app: &App| {
|
||||
settings
|
||||
.project
|
||||
.all_languages
|
||||
@@ -668,7 +668,7 @@ fn codestral_settings() -> Box<[SettingsPageItem]> {
|
||||
.max_tokens
|
||||
.as_ref()
|
||||
},
|
||||
write: |settings, value| {
|
||||
write: |settings, value, _app: &App| {
|
||||
settings
|
||||
.project
|
||||
.all_languages
|
||||
@@ -698,7 +698,7 @@ fn codestral_settings() -> Box<[SettingsPageItem]> {
|
||||
.model
|
||||
.as_ref()
|
||||
},
|
||||
write: |settings, value| {
|
||||
write: |settings, value, _app: &App| {
|
||||
settings
|
||||
.project
|
||||
.all_languages
|
||||
|
||||
@@ -100,7 +100,7 @@ struct FocusFile(pub u32);
|
||||
|
||||
struct SettingField<T: 'static> {
|
||||
pick: fn(&SettingsContent) -> Option<&T>,
|
||||
write: fn(&mut SettingsContent, Option<T>),
|
||||
write: fn(&mut SettingsContent, Option<T>, &App),
|
||||
|
||||
/// A json-path-like string that gives a unique-ish string that identifies
|
||||
/// where in the JSON the setting is defined.
|
||||
@@ -149,7 +149,7 @@ impl<T: 'static> SettingField<T> {
|
||||
fn unimplemented(self) -> SettingField<UnimplementedSettingField> {
|
||||
SettingField {
|
||||
pick: |_| Some(&UnimplementedSettingField),
|
||||
write: |_, _| unreachable!(),
|
||||
write: |_, _, _| unreachable!(),
|
||||
json_path: self.json_path,
|
||||
}
|
||||
}
|
||||
@@ -232,8 +232,8 @@ impl<T: PartialEq + Clone + Send + Sync + 'static> AnySettingField for SettingFi
|
||||
None,
|
||||
window,
|
||||
cx,
|
||||
move |settings, _| {
|
||||
(this.write)(settings, value_to_set);
|
||||
move |settings, app| {
|
||||
(this.write)(settings, value_to_set, app);
|
||||
},
|
||||
)
|
||||
// todo(settings_ui): Don't log err
|
||||
@@ -4090,8 +4090,8 @@ fn render_text_field<T: From<String> + Into<String> + AsRef<str> + Clone>(
|
||||
field.json_path,
|
||||
window,
|
||||
cx,
|
||||
move |settings, _cx| {
|
||||
(field.write)(settings, new_text.map(Into::into));
|
||||
move |settings, app| {
|
||||
(field.write)(settings, new_text.map(Into::into), app);
|
||||
},
|
||||
)
|
||||
.log_err(); // todo(settings_ui) don't log err
|
||||
@@ -4122,8 +4122,8 @@ fn render_toggle_button<B: Into<bool> + From<bool> + Copy>(
|
||||
telemetry::event!("Settings Change", setting = field.json_path, type = file.setting_type());
|
||||
|
||||
let state = *state == ui::ToggleState::Selected;
|
||||
update_settings_file(file.clone(), field.json_path, window, cx, move |settings, _cx| {
|
||||
(field.write)(settings, Some(state.into()));
|
||||
update_settings_file(file.clone(), field.json_path, window, cx, move |settings, app| {
|
||||
(field.write)(settings, Some(state.into()), app);
|
||||
})
|
||||
.log_err(); // todo(settings_ui) don't log err
|
||||
}
|
||||
@@ -4157,8 +4157,8 @@ fn render_editable_number_field<T: NumberFieldType + Send + Sync>(
|
||||
field.json_path,
|
||||
window,
|
||||
cx,
|
||||
move |settings, _cx| {
|
||||
(field.write)(settings, Some(value));
|
||||
move |settings, app| {
|
||||
(field.write)(settings, Some(value), app);
|
||||
},
|
||||
)
|
||||
.log_err(); // todo(settings_ui) don't log err
|
||||
@@ -4197,8 +4197,8 @@ where
|
||||
field.json_path,
|
||||
window,
|
||||
cx,
|
||||
move |settings, _cx| {
|
||||
(field.write)(settings, Some(value));
|
||||
move |settings, app| {
|
||||
(field.write)(settings, Some(value), app);
|
||||
},
|
||||
)
|
||||
.log_err(); // todo(settings_ui) don't log err
|
||||
@@ -4252,8 +4252,8 @@ fn render_font_picker(
|
||||
field.json_path,
|
||||
window,
|
||||
cx,
|
||||
move |settings, _cx| {
|
||||
(field.write)(settings, Some(font_name.to_string().into()));
|
||||
move |settings, app| {
|
||||
(field.write)(settings, Some(font_name.to_string().into()), app);
|
||||
},
|
||||
)
|
||||
.log_err(); // todo(settings_ui) don't log err
|
||||
@@ -4302,10 +4302,11 @@ fn render_theme_picker(
|
||||
field.json_path,
|
||||
window,
|
||||
cx,
|
||||
move |settings, _cx| {
|
||||
move |settings, app| {
|
||||
(field.write)(
|
||||
settings,
|
||||
Some(settings::ThemeName(theme_name.into())),
|
||||
app,
|
||||
);
|
||||
},
|
||||
)
|
||||
@@ -4355,10 +4356,11 @@ fn render_icon_theme_picker(
|
||||
field.json_path,
|
||||
window,
|
||||
cx,
|
||||
move |settings, _cx| {
|
||||
move |settings, app| {
|
||||
(field.write)(
|
||||
settings,
|
||||
Some(settings::IconThemeName(theme_name.into())),
|
||||
app,
|
||||
);
|
||||
},
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user