Skip to content

Commit

Permalink
Split the row and column in many buttons into two text sections with …
Browse files Browse the repository at this point in the history
…different colours.
  • Loading branch information
ickshonpe committed Feb 11, 2025
1 parent 5e9da92 commit c6509ee
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions examples/stress_tests/many_buttons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,14 +289,23 @@ fn spawn_button(

if spawn_text {
builder.with_children(|parent| {
parent.spawn((
Text(format!("{column}, {row}")),
TextFont {
font_size: FONT_SIZE,
..default()
},
TextColor(Color::srgb(0.2, 0.2, 0.2)),
));
parent
.spawn((
Text(format!("{column}, ")),
TextFont {
font_size: FONT_SIZE,
..default()
},
TextColor(Color::srgb(0.5, 0.2, 0.2)),
))
.with_child((
TextSpan(format!("{row}")),
TextFont {
font_size: FONT_SIZE,
..default()
},
TextColor(Color::srgb(0.2, 0.2, 0.5)),
));
});
}
}
Expand Down

0 comments on commit c6509ee

Please sign in to comment.