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 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. panel is 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 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.
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 modal it hides what it covers once openness reaches 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.