Skip to main content

Theme

Struct Theme 

Source
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: NativeFeel

The 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

Source

pub const PRESETS: &'static [fn() -> Theme]

Every preset, light+dark where applicable, for a switcher/gallery.

Source

pub fn windows_dark() -> Self

Windows, dark.

Source

pub fn windows_light() -> Self

Windows, light.

Source

pub fn windows() -> Self

The default Windows theme (dark) — windows() for the work-order name.

Source

pub fn macos_dark() -> Self

macOS, dark.

Source

pub fn macos_light() -> Self

macOS, light.

Source

pub fn macos() -> Self

The default macOS theme (dark).

Source

pub fn device() -> Self

Device — barren, effects-off, sunlight-legible, crisp (§23). GPU still allowed (PerfConfig.prefer_wgpu) — just no eye-candy.

Source

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.

Source

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".

Source

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.

Source

pub fn nordisk_light() -> Self

Nordisk (light) — the airy daytime key of the flagship identity.

Source

pub fn nordisk() -> Self

The default Nordisk theme (dark) — the flagship identity look.

Source

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.

Source

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.

Source

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()).

Source

pub fn preset_names() -> Vec<String>

Source

pub fn by_name(name: &str) -> Option<Theme>

Source

pub fn with_effects(self, e: EffectsPolicy) -> Self

Source

pub fn with_keymap(self, k: KeyMap) -> Self

Source

pub fn with_focus(self, f: FocusSpec) -> Self

Source

pub fn with_surface(self, s: SurfaceSpec) -> Self

Source

pub fn with_name(self, n: impl Into<String>) -> Self

Source

pub fn is_dark(&self) -> bool

Is this theme dark? (Resolves FollowSystem via the palette’s own flag.)

Source

pub fn egui_style(&self) -> Style

Build a complete egui::Style from this theme (visuals + spacing + scroll

  • text scale). Pure — apply installs it on a context.
Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for Theme

Source§

fn clone(&self) -> Theme

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Theme

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Theme

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Theme

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Theme

Source§

fn eq(&self, other: &Theme) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Theme

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Theme

Auto Trait Implementations§

§

impl Freeze for Theme

§

impl RefUnwindSafe for Theme

§

impl Send for Theme

§

impl Sync for Theme

§

impl Unpin for Theme

§

impl UnsafeUnpin for Theme

§

impl UnwindSafe for Theme

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(value: T, _simd: S) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.