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 the whole window behind a modal Panel, the part under the panel
included. Floating material blurs the scene recorded behind it, so the
scrim belongs under the material: a bright control behind the panel (a
primary button) is dimmed with everything else before it is blurred,
instead of glowing through the sheet as a coloured smudge.
panelis where the sheet stands; the dim does not stop at its edge. - 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. - whole_
view - The ground of a whole-view surface that pictures the windows it covers
(the workspace overview): the desktop, blurred and tinted as the
floating material is, over everything drawn before it, then the modal
dim. Unlike
modalit hides what it covers onceopennessreaches 1, because the surface shows those windows itself and they must not be seen twice; on the way there they fade out under it. Opaque base where the theme does not blur (reduced transparency, forced colours) or no desktop is published. Call after everything it covers is drawn.