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.
- Role
Finishes - One finish per surface role: the theme document’s
materialrole (crate::theme::ThemeMaterial) as the toolkit paints it.
Enums§
- Border
Ink - Which ink a border is drawn in.
- Chrome
Material - 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.
- Surface
Role - 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
groundshows, 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 standsmaterial_spreadoff 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
groundmay 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 ratioron the ground keepsr / spreadon the band’s far end; the spread is the least ofr / floorover the three ink tiers (body text for primary and secondary, large text for tertiary, AAA text on a high-contrast palette), never below1(an opaque surface). - role_
ground - The opaque ground a surface of
roleis tinted with. - worst_
grounds - What a surface of
rolecan look like at its darkest and its lightest underfinishes, 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.