mirror of
https://github.com/emilk/egui.git
synced 2026-09-02 06:40:06 -04:00
Fix override_text_color priority (#7439)
The override_text_color is now used when rendering text from a String or &str. This is consistent with the RichText variant and makes the option behave as advertised, taking precedence over WidgetVisuals and overriding the color for all text unless explicitly changed for a single widget (via RichText or LayoutJob). * Closes <https://github.com/emilk/egui/issues/7367> * [x] I have followed the instructions in the PR template --------- Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
@@ -746,13 +746,17 @@ impl WidgetText {
|
||||
) -> Arc<Galley> {
|
||||
match self {
|
||||
Self::Text(text) => {
|
||||
let color = style
|
||||
.visuals
|
||||
.override_text_color
|
||||
.unwrap_or(crate::Color32::PLACEHOLDER);
|
||||
let mut layout_job = LayoutJob::simple_format(
|
||||
text,
|
||||
TextFormat {
|
||||
// We want the style overrides to take precedence over the fallback font
|
||||
font_id: FontSelection::default()
|
||||
.resolve_with_fallback(style, fallback_font),
|
||||
color: crate::Color32::PLACEHOLDER,
|
||||
color,
|
||||
valign: default_valign,
|
||||
..Default::default()
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user