Change background color of a single ui element #4902
-
Hi, I want to modify the background and border color of a single UI element. pub fn state_badge(ui: &mut egui::Ui, state: &FicheState) {
ui.vertical_centered(|ui| {
ui.label(state.get_text());
});
} I tried using style, but it seemed to do nothing. Can anyone help me, please? |
Beta Was this translation helpful? Give feedback.
Answered by
chianti-ga
Aug 1, 2024
Replies: 1 comment
-
i found a way to do it let frame = egui::Frame::none()
.fill(hex_color!("#262626"))
.rounding(Rounding {
nw: 25.0,
ne: 25.0,
sw: 25.0,
se: 25.0,
})
.inner_margin(Margin {
left: 10.0,
right: 10.0,
top: 10.0,
bottom: 10.0,
}).outer_margin(Margin {
left: 10.0,
right: 10.0,
top: 10.0,
bottom: 10.0,
});
frame.show(ui, |ui| {
ui.vertical(|ui| {
//blablabla
});
});
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
chianti-ga
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
i found a way to do it