pub struct VisualStyle {
pub bg: Color,
pub border_color: Color,
pub border_w: f32,
pub radius: [f32; 4],
pub opacity: f32,
pub shadow: Shadow,
pub pixel_snap: bool,
}Expand description
The paint half of a NodeSpec: background, border, corner radii,
opacity, shadow and pixel snapping.
Fields§
§bg: Color§border_color: Color§border_w: f32§radius: [f32; 4]Corner radii (logical px), clockwise from the top-left:
[tl, tr, br, bl]. NodeSpec::radius sets all four; the per-corner
builders (radius_tl, …) override one — later calls win, like CSS
border-radius followed by border-top-left-radius.
opacity: f32Group opacity, 0..=1 and 1 by default: multiplied into the alpha of
every quad this node and its subtree emit, and into every
descendant’s own opacity. This is the cheap group opacity — a
per-quad alpha multiply, not an offscreen composite — so a subtree
whose own pieces overlap shows its seams through the fade where a
compositing implementation would not. Nothing else changes: an
invisible subtree still lays out, still takes clicks and is still
read by assistive technology, exactly like CSS opacity: 0.
shadow: ShadowThe drop shadow cast behind this node (see Shadow).
pixel_snap: boolPaint the background, border, shadow and fragment with each edge on
a whole physical pixel (pixelSnap). Off by default: a box is drawn where
layout put it, so a gap between two boxes is there at any scale.
On, its edges land where a text’s backgrounds’ do and where every
other snapped box’s do, so snapped boxes that share an edge in
layout, and a snapped box beside a text’s background, meet without
a seam. Layout, hit-testing and the children are untouched.