Skip to main content

Module scrim

Module scrim 

Expand description

Scrims: the dim behind a modal Panel and the fade under text on media.

Both read their colour from the theme (surfaces.scrim, media.scrim). A scrim is never a literal colour and never an opaque fill, so what it covers stays visible behind it.

Enums§

FadeEdge
The edge of a vertical_fade where it is strongest.

Constants§

MIN_FADE_STRENGTH
The least a fade over media is: over dark content (a night map, a dark photo) a fainter scrim does not move the picture enough to read as a band under the text, so any fade at all is at least this strong.

Functions§

behind_panel
Dim only the background around a modal’s foreground. Floating material records the scene behind it for blur, so dimming underneath the panel would also darken the material a foreground control stands on.
fade_alpha
The fade’s opacity at t (0 at the strong edge, 1 at the clear one): a smoothstep from strength to clear, flat at both ends so neither end of the fade reads as a line.
modal
Dim rect (the whole window) behind a modal Panel. openness runs from 0 (closed) to 1 (open), so the scrim fades in with the panel. Call after everything it dims is drawn into the same scene.
vertical_fade
Fade rect from media.scrim at strength on edge to clear on the opposite edge, so text drawn on media near that edge (in media.ink) stays legible. One smooth gradient, eased so the fade has no visible start line; never stepped bands. strength is clamped to MIN_FADE_STRENGTH..=1; zero paints nothing.