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.

agent_ui: Match ACP boolean option label colors (#61103)

Josh Kent27ff74540bfc
diff --git a/crates/agent_ui/src/config_options.rs b/crates/agent_ui/src/config_options.rs
index df4eecaccd5..ccb821f9b2d 100644
--- a/crates/agent_ui/src/config_options.rs
+++ b/crates/agent_ui/src/config_options.rs
@@ -581,6 +581,7 @@ impl Render for ConfigOptionSelector {
.label(option_name)
.label_position(SwitchLabelPosition::Start)
.label_size(LabelSize::Small)
+ .label_color(Color::Muted)
.disabled(self.setting_value)
.on_click(move |state, _window, cx| {
let next_value = matches!(state, ToggleState::Selected);
diff --git a/crates/ui/src/components/toggle.rs b/crates/ui/src/components/toggle.rs
index 9991b92ce38..236eda9690a 100644
--- a/crates/ui/src/components/toggle.rs
+++ b/crates/ui/src/components/toggle.rs
@@ -343,6 +343,7 @@ pub struct Switch {
label: Option<SharedString>,
label_position: Option<SwitchLabelPosition>,
label_size: LabelSize,
+ label_color: Color,
full_width: bool,
key_binding: Option<KeyBinding>,
color: SwitchColor,
@@ -362,6 +363,7 @@ impl Switch {
label: None,
label_position: None,
label_size: LabelSize::Small,
+ label_color: Color::Default,
full_width: false,
key_binding: None,
color: SwitchColor::default(),
@@ -411,6 +413,11 @@ impl Switch {
self
}
+ pub fn label_color(mut self, color: Color) -> Self {
+ self.label_color = color;
+ self
+ }
+
pub fn full_width(mut self, full_width: bool) -> Self {
self.full_width = full_width;
self
@@ -543,7 +550,11 @@ impl RenderOnce for Switch {
self.label_position == Some(SwitchLabelPosition::Start),
|this| {
this.when_some(label.clone(), |this, label| {
- this.child(Label::new(label).size(self.label_size))
+ this.child(
+ Label::new(label)
+ .size(self.label_size)
+ .color(self.label_color),
+ )
})
},
)
@@ -552,7 +563,11 @@ impl RenderOnce for Switch {
self.label_position == Some(SwitchLabelPosition::End),
|this| {
this.when_some(label, |this, label| {
- this.child(Label::new(label).size(self.label_size))
+ this.child(
+ Label::new(label)
+ .size(self.label_size)
+ .color(self.label_color),
+ )
})
},
)