pub struct Theme {Show 13 fields
pub name: String,
pub mode: ThemeMode,
pub palette: Palette,
pub typography: Typography,
pub metrics: Metrics,
pub scroll: ScrollSpec,
pub keymap: KeyMap,
pub focus: FocusSpec,
pub surface: SurfaceSpec,
pub motion: Motion,
pub effects: EffectsPolicy,
pub perf: PerfConfig,
pub native: NativeFeel,
}Expand description
The one theme (ARCH-1). Every sub-struct is fully populated by every preset
(no leaked defaults, ARCH-3); fields are public with with_* builders
(ARCH-5); the whole thing is serde (ARCH-4).
Fields§
§name: String§mode: ThemeMode§palette: Palette§typography: Typography§metrics: Metrics§scroll: ScrollSpec§keymap: KeyMap§focus: FocusSpec§surface: SurfaceSpec§motion: Motion§effects: EffectsPolicy§perf: PerfConfig§native: NativeFeelThe platform-adaptive native-feel cues (reveal highlight, rubber-band,
focus-ring style, window-control side, accent-tint, elevation) layered over
the primitives above. See platform.
Implementations§
Source§impl Theme
impl Theme
Sourcepub const PRESETS: &'static [fn() -> Theme]
pub const PRESETS: &'static [fn() -> Theme]
Every preset, light+dark where applicable, for a switcher/gallery.
Sourcepub fn windows_dark() -> Self
pub fn windows_dark() -> Self
Windows, dark.
Sourcepub fn windows_light() -> Self
pub fn windows_light() -> Self
Windows, light.
Sourcepub fn macos_dark() -> Self
pub fn macos_dark() -> Self
macOS, dark.
Sourcepub fn macos_light() -> Self
pub fn macos_light() -> Self
macOS, light.
Sourcepub fn device() -> Self
pub fn device() -> Self
Device — barren, effects-off, sunlight-legible, crisp (§23). GPU still allowed (PerfConfig.prefer_wgpu) — just no eye-candy.
Sourcepub fn neutral() -> Self
pub fn neutral() -> Self
Neutral — the cross-platform / Linux default: premium and full-effects,
but with no OS-specific chrome (no traffic lights, no reveal highlight,
no rubber-band). Moderate radii, the System font, solid scrollbars, gentle
cubic motion. This is what Platform::Neutral selects and the third stop
of the demo’s Mac ⇄ Windows ⇄ Neutral toggle.
Sourcepub fn skade_vinter() -> Self
pub fn skade_vinter() -> Self
Skaði “Skade Vinter” — an icy winter showcase theme (glacier blues,
frost/ice-white, pale cyan over deep-winter navy), full effects so the
ice-drip decor + frost shimmer light up. The look the holger demo swaps to
in its static “winter” mode via the COH-1 bridge (replaces the old red
uboat/silent-running theme). Authored fresh — there is no SVT/skade UI to
port. Serde name + by_name: "skade_vinter".
Sourcepub fn nordisk_dark() -> Self
pub fn nordisk_dark() -> Self
Nordisk (dark) — facett’s own flagship identity, and the recommended default look: a calm, premium Nordic take on the Windows-11/macOS idiom with a signature aurora-cyan accent. OS-agnostic (no traffic lights, no reveal), full-effects, soft 8px radii, a cool frosted-glass surface. This is what the demo opens on and the “its own identity” stop of the toggle.
Sourcepub fn nordisk_light() -> Self
pub fn nordisk_light() -> Self
Nordisk (light) — the airy daytime key of the flagship identity.
Sourcepub fn from_os(os: OperatingSystem) -> Self
pub fn from_os(os: OperatingSystem) -> Self
Pick a preset from the running OS (ARCH-3). Falls back to Windows-dark on
Linux/unknown (documented default). This is the egui-OS bridge (used by
the host at startup); the cfg-detected Platform path is
for_platform.
Sourcepub fn for_platform(p: Platform) -> Self
pub fn for_platform(p: Platform) -> Self
Pick the platform-adaptive native-feel preset for an explicit
Platform (the cfg-detected or runtime-overridden one). Mac →
macOS-dark, Windows → Windows-dark, Neutral → the neutral preset. The
entry point the demo’s Mac ⇄ Windows ⇄ Neutral toggle drives.
Sourcepub fn for_detected_platform() -> Self
pub fn for_detected_platform() -> Self
The preset selected by auto-detecting the host platform
(cfg!(target_os)), with no override. Convenience for
Theme::for_platform(Platform::detect()).
pub fn preset_names() -> Vec<String>
pub fn by_name(name: &str) -> Option<Theme>
pub fn with_effects(self, e: EffectsPolicy) -> Self
pub fn with_keymap(self, k: KeyMap) -> Self
pub fn with_focus(self, f: FocusSpec) -> Self
pub fn with_surface(self, s: SurfaceSpec) -> Self
pub fn with_name(self, n: impl Into<String>) -> Self
Sourcepub fn is_dark(&self) -> bool
pub fn is_dark(&self) -> bool
Is this theme dark? (Resolves FollowSystem via the palette’s own flag.)
Sourcepub fn egui_style(&self) -> Style
pub fn egui_style(&self) -> Style
Build a complete egui::Style from this theme (visuals + spacing + scroll
- text scale). Pure —
applyinstalls it on a context.
Sourcepub fn apply(&self, ctx: &Context)
pub fn apply(&self, ctx: &Context)
ARCH-2 — install the full style + publish the derived legacy palette in
one call. Re-applying takes effect next frame, no restart. Also sets the OS
(KEY-3) so Modifiers::COMMAND formats as ⌘/Ctrl correctly and built-in
shortcuts match the preset.
Sourcepub fn to_legacy_palette(&self) -> Theme
pub fn to_legacy_palette(&self) -> Theme
Derive the legacy flat crate::Theme palette from the semantic roles, so
existing components that read crate::theme(ui) follow this theme. This is
the compatibility bridge: the rich Theme is the source of truth; the
flat palette is computed, never authored.