Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Use specified color for non-highlighted text in `HighlightedLabel` (#3509)
Marshall Bowersf833cd7c1602
diff --git a/crates/ui2/src/components/label.rs b/crates/ui2/src/components/label.rsindex 7aeda3e850f..d455a041ee6 100644--- a/crates/ui2/src/components/label.rs+++ b/crates/ui2/src/components/label.rs@@ -129,6 +129,9 @@ impl RenderOnce for HighlightedLabel {));}+ let mut text_style = cx.text_style().clone();+ text_style.color = self.color.color(cx);+div().flex().when(self.strikethrough, |this| {@@ -146,7 +149,7 @@ impl RenderOnce for HighlightedLabel {LabelSize::Default => this.text_ui(),LabelSize::Small => this.text_ui_sm(),})- .child(StyledText::new(self.label).with_highlights(&cx.text_style(), highlights))+ .child(StyledText::new(self.label).with_highlights(&text_style, highlights))}}diff --git a/crates/ui2/src/components/stories/label.rs b/crates/ui2/src/components/stories/label.rsindex 2417bee6e1c..e026d388fde 100644--- a/crates/ui2/src/components/stories/label.rs+++ b/crates/ui2/src/components/stories/label.rs@@ -23,5 +23,9 @@ impl Render for LabelStory {"Héllo, world!",vec![0, 1, 3, 8, 9, 13],))+ .child(Story::label("Highlighted with `color`"))+ .child(+ HighlightedLabel::new("Hello, world!", vec![0, 1, 2, 7, 8, 12]).color(Color::Error),+ )}}