pub fn visuals(palette: &Palette, radius: CornerRadius) -> VisualsExpand description
The colours egui draws its own widgets with, from this palette.
radius is the app’s own container radius, because how round a thing is
is a house style rather than a fact about the palette. Square is a
defensible default and so is not: this crate does not pick.
Three choices here are worth their reasoning, because each was arrived at by getting it wrong first.
The pressed fill stays neutral rather than taking the action colour.
egui derives strong_text_color() from widgets.active.fg_stroke, so an
accent-coloured pressed background forces the foreground to contrast with
the accent, and that colour is then what every RichText::strong() in the
application is painted in. The accent shows up in the focus ring instead,
where it belongs.
weak_bg_fill is set alongside every bg_fill. egui’s Button paints
from the weak one and only reaches for bg_fill once hovered, so a theme
that sets only bg_fill leaves every resting button at the preset default:
near-black under a light theme, near-white under a dark one.
Nothing expands on hover. A widget that swells a point under the cursor drags its own bevel outward while the surface beneath it stays put, which fights the light model the bevel pair describes. State change is carried by the bevel inverting, which is a stronger signal and costs no layout.