ltk::theme

Module shadow

Source
Expand description

Shadow primitives: outer drop shadows, inner inset shadows, and the blend modes used to composite them.

§Units

Shadow::blur and InsetShadow::blur store the CSS blur radius, not the SVG stdDeviation. The relationship is blur = 2 × stdDeviation, which is what browsers compute for box-shadow: … blur …. The shader integrates against sigma, so it applies sigma = blur / 2 internally (see Shadow::sigma).

§Order

A theme’s shadows list is stored back-to-front, mirroring SVG’s feBlend stacking order. The first entry is painted first (lowest layer), the last entry is painted last (topmost). This is the inverse of CSS box-shadow string order. Documented here so the renderer loop (for shadow in shadows { ... }) produces the visually correct result without reversing.

Structs§

  • An inset shadow: a shadow painted inside the shape’s silhouette, as opposed to the outer drop shadow cast behind it.
  • An outer drop shadow cast by a shape.

Enums§

  • How a shadow composites against the layers below it.
  • How a crate::theme::Surface refers to its outer shadow stack: either by name (reused across several surfaces — the common case for elevation tokens) or inline (one-off, uncommon).