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§
- Fade
Edge - The edge of a
vertical_fadewhere 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 fromstrengthto 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.opennessruns 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
rectfrommedia.scrimatstrengthonedgeto clear on the opposite edge, so text drawn on media near that edge (inmedia.ink) stays legible. One smooth gradient, eased so the fade has no visible start line; never stepped bands.strengthis clamped toMIN_FADE_STRENGTH..=1; zero paints nothing.