Expand description
Layered drop-shadow helper for elevated surfaces.
Composes two [Shadow]s underneath a rounded rect:
outer— the wide soft halo (typicallytheme.shape.shadow_*).inner— the sharp short-blur rim that gives the surface a clearly “lifted” edge instead of a vague glow (typically the matchingtheme.shape.shadow_inner_*).
The inner token’s geometry (offset_y, blur, color.rgb) is used
verbatim. Only color.a is modulated: the painted alpha is
density × inner.color.a(), with density ∈ [0.0, 1.0] provided by
the per-component shadow_density field. This keeps every visual
knob in the theme while letting individual surfaces dial intensity.
Common density presets:
1.0— tooltips (full inner-rim alpha, punchy “lift”).~0.5— cards, popovers, menus (moderate).0.0— disable inner rim entirely (single-layer outer only).
§Attached side
Popovers, menus and combo-box dropdowns sit attached to the widget
that opened them. On the side that touches the trigger, drawing a
halo would visually cut the surface off from its anchor. Pass an
AttachedSide to suppress shadow on that side.
ⓘ
// Typical usage inside a custom widget's paint() method:
use teksilo_widgets::shadow::{paint_layered_shadow, DENSITY_SURFACE};
paint_layered_shadow(
canvas, bounds, radius,
&ctx.theme.shape.shadow_sm,
&ctx.theme.shape.shadow_inner_sm,
DENSITY_SURFACE,
None,
);Enums§
- Attached
Side - Which geometric edge of the surface is attached to its trigger and should have shadow drawing suppressed on that side. Geometric (Top / Bottom / Left / Right), not RTL-aware — callers working in Leading/Trailing terms must resolve to a geometric side using the active layout direction before calling.
Constants§
- DENSITY_
DIALOG - Inner-rim alpha multiplier for snackbars and dialogs — subtle lift.
- DENSITY_
SURFACE - Inner-rim alpha multiplier for cards, popovers, and menus — moderate lift.
- DENSITY_
TOOLTIP - Inner-rim alpha multiplier for tooltips — full intensity for maximum lift.
Functions§
- paint_
layered_ shadow - Paint a two-layer drop shadow behind a rounded rect.