Expand description
Theme tokens of the UI refresh; read only by ui_kit and its preview so far.
Theme tokens: the one place a colour, size, radius, shadow or duration of
the refreshed UI is written (section 3).
STATUS: rollout step 1. Nothing in the app reads these tokens except the
developer gallery (crate::ui_kit::gallery) and its whole-app PREVIEW,
which is off unless the gallery turns it on. With the gallery closed and the
preview off the app makes no call into this module.
A Theme is built per mode (dark, light), density (compact, comfortable)
and accent. Theme::apply writes it into an egui::Style, which restyles
every default egui widget; the crate::ui_kit components read the tokens
directly through Theme::of.
Modules§
Structs§
- Accent
- One accent the owner can choose between (spec section 9, decision 2).
- Families
- The font families the theme draws with. Until a UI font is chosen and bound (spec section 9, decision 1) all three are egui’s own families, so a theme can always be drawn.
- Palette
- The colour roles (spec section 3). Every colour is opaque except the three overlays, which are laid over whatever surface the control sits on.
- Theme
- One theme: every token a component or the base egui style needs.
Enums§
- Density
- Control heights and spacing. Compact is the proposed default (spec section 2).
- Mode
- Dark or light chrome. The 3D viewport’s colours are render settings and are not part of the theme.
- Text
- The type scale (spec section 4).
Constants§
- ACCENTS
- The accent candidates. The first is the spec’s proposal.
- BORDER
- Every border is 1 px; a focus ring or an active bar is 2 px.
- RING
Functions§
- accent
- The accent with this key.
- clear
- Forget the stored theme.
- contrast
- WCAG contrast ratio of two opaque colours (1 to 21).
- current
- The stored theme, or the default.
- luminance
- WCAG relative luminance of an opaque colour.
- mix
amovedtof the way tob(both opaque).- over
toplaid over the opaquebaseattop’s own alpha.- set
- Make
themethe oneTheme::ofanswers for this context. - stored
- The stored theme, if one is stored.