Skip to main content

Module finish

Module finish 

Expand description

Finishes: what each surface role is made of, how its edges are drawn and how it stands off what is below it (docs/architecture/theming.md, “Material, shape and depth”).

A theme document sets one Finish per surface role (RoleFinishes: the window ground, raised controls, floating chrome and bars), one Border and one Depth. The toolkit paints every surface of a role with the role’s painter set (crate::part_paint, through crate::surface and crate::backdrop), so a theme makes everything flat and blocky or everything glass without an app or widget knowing.

Legibility never depends on a finish: whatever lies below a translucent or glass surface is held inside a band around the role’s ground before the tint is laid over it (crate::backdrop::material_band), so ink keeps the contrast it has on the opaque ground over the worst backdrop (crate::theme::ThemeDocument::findings).

Structs§

Border
How surfaces are outlined.
Finish
What one surface role is made of: the painter set that draws it and that set’s parameters.
RoleFinishes
One finish per surface role: the theme document’s material role (crate::theme::ThemeMaterial) as the toolkit paints it.

Enums§

BorderInk
Which ink a border is drawn in.
ChromeMaterial
What the shell’s chrome — its bar and its dock — is made of, as the person chose it.
Depth
How a surface stands off what is below it.
SurfaceRole
The surface roles a theme finishes. Each is a level of the design language (docs/design-language.md, “Surfaces”).

Constants§

MATERIAL_SPREAD
How far, as a contrast ratio, a translucent surface may stand off its ground anywhere, whatever is behind it. Every ink drawn on a surface is chosen to clear 7:1 on the opaque ground (SMALL_TEXT_MIN_CONTRAST; a disabled row’s dim ink included), so on the material it still clears 7 / 1.5 ≈ 4.7:1, above body text’s 4.5:1 with room for 8-bit rounding.

Functions§

material_band
The darkest and the lightest colour a translucent surface of ground shows, whatever lies below it: on the side of the ground its ink stands on, the ground stepped toward that end of the theme’s neutral ramp until it stands material_spread off it (or reaches the end); on the other side, the ramp’s end itself. The backdrop pass compresses what shows through into this band before the tint is laid over it (crate::backdrop::Legible), so these are the worst backdrops ink on the material is measured against.
material_spread
How far what shows through a translucent surface of ground may stand off it: MATERIAL_SPREAD, narrowed to what the theme’s inks can afford. Contrast ratios on one side of a ground divide exactly, so ink with ratio r on the ground keeps r / spread on the band’s far end; the spread is the least of r / floor over the three ink tiers (body text for primary and secondary, large text for tertiary, AAA text on a high-contrast palette), never below 1 (an opaque surface).
role_ground
The opaque ground a surface of role is tinted with.
worst_grounds
What a surface of role can look like at its darkest and its lightest under finishes, over any backdrop: the role’s ground when it is opaque; the band around it (material_band) when it shows a blurred backdrop; and for a translucent control, which is never blurred, its ground at its tint over the darkest and lightest window it can stand on.