Use specified color for non-highlighted text in HighlightedLabel
(#3509)
This PR fixes an issue where the specified color for a `HighlightedLabel` was not respected as the default color for non-highlighted text. Release Notes: - N/A
This commit is contained in:
parent
54ea7257ff
commit
f833cd7c16
2 changed files with 8 additions and 1 deletions
|
@ -129,6 +129,9 @@ impl RenderOnce for HighlightedLabel {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut text_style = cx.text_style().clone();
|
||||||
|
text_style.color = self.color.color(cx);
|
||||||
|
|
||||||
div()
|
div()
|
||||||
.flex()
|
.flex()
|
||||||
.when(self.strikethrough, |this| {
|
.when(self.strikethrough, |this| {
|
||||||
|
@ -146,7 +149,7 @@ impl RenderOnce for HighlightedLabel {
|
||||||
LabelSize::Default => this.text_ui(),
|
LabelSize::Default => this.text_ui(),
|
||||||
LabelSize::Small => this.text_ui_sm(),
|
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))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,5 +23,9 @@ impl Render for LabelStory {
|
||||||
"Héllo, world!",
|
"Héllo, world!",
|
||||||
vec![0, 1, 3, 8, 9, 13],
|
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),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue