Skip to content

Table header color #4899

Answered by YgorSouza
hendrix63 asked this question in Q&A
Aug 1, 2024 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

You can use the same trick that the table itself uses internally to paint the stripes and the selected row:

let max_rect = self.cell_rect(&width, &height);
// Make sure we don't have a gap in the stripe/frame/selection background:
let item_spacing = self.ui.spacing().item_spacing;
let gapless_rect = max_rect.expand2(0.5 * item_spacing);
if flags.striped {
self.ui.painter().rect_filled(
gapless_rect,
egui::Rounding::ZERO,
self.ui.visuals().faint_bg_color,
);
}
if flags.selected {
self.ui.painter().rect_filled(
gapless_rect,
egui::R…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@hendrix63
Comment options

Answer selected by hendrix63
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants