Skip to content

Add UiStack::bg_color#8020

Merged
emilk merged 3 commits intomainfrom
emilk/bg-color
Mar 25, 2026
Merged

Add UiStack::bg_color#8020
emilk merged 3 commits intomainfrom
emilk/bg-color

Conversation

@emilk
Copy link
Copy Markdown
Owner

@emilk emilk commented Mar 25, 2026

This lets you ask for the background color of a ui with ui.stack().bg_color()

@emilk emilk added feature New feature or request egui labels Mar 25, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 25, 2026

Preview available at https://egui-pr-preview.github.io/pr/8020-emilkbg-color
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

View snapshot changes at kitdiff

@emilk emilk merged commit e8f0429 into main Mar 25, 2026
44 of 46 checks passed
@emilk emilk deleted the emilk/bg-color branch March 25, 2026 11:41
Comment on lines +266 to +274
for node in self.iter() {
let fill = node.frame().fill;
if fill.is_opaque() {
return fill;
} else if fill != Color32::TRANSPARENT {
total = fill.blend(total);
}
}
total
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think theres a bug here, if one if the parent layers is opaque, and the current one is semi transparent, we would disregard the transparent color and just return the opaque one without blending

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Masterchef365 pushed a commit to Masterchef365/egui that referenced this pull request Apr 3, 2026
This lets you ask for the background color of a ui with
`ui.stack().bg_color()`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

egui feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants