Skip to main content

Crate teksilo_theme_fluent

Crate teksilo_theme_fluent 

Source
Expand description

Fluent (Windows 11 / WinUI 3) theme preset for Teksilo.

A full Fluent theme: the WinUI theme-resource colour dictionaries, the two-radius geometry, the WinUI type ramp, Fluent’s control durations and easing, and Tier-3 chrome for the widgets whose WinUI counterpart is structurally its own thing.

ⓘ
use teksilo_theme_fluent as fluent;

TeksiloAppBuilder::new()
    .theme(fluent::light())
    .initial_window(WindowConfig::new().title("Fluent demo"))
    .run();

§What makes it read as Fluent

  • The elevation edge. A raised control carries a heavier stroke on one edge — the bottom in light (a cast shadow), the top in dark (a catch-light) — and loses it when pressed. WinUI gets this from a gradient border brush anchored to a fixed 3 dp band; see palette::FluentEdgeSide.
  • A high-contrast focus ring, never the accent. Two tones: a 2 dp near-black (light) or white (dark) outer ring with a 1 dp opposite inner ring between it and the control. It reads on any background, which is why Fluent does not tint it.
  • The accent focus underline. A focused field’s bottom edge grows to 2 dp and turns accent while its fill brightens.
  • Neutral selection plus an accent pill. A selected list row gets a grey wash and a 3 × 16 dp accent bar on its leading edge.
  • An asymmetric accent ramp. The light theme fills with a darkened accent and white labels, the dark theme with a lightened one and black labels — which is how both clear contrast from one seed colour.

§Two radii, 32 dp, no tracking

Fluent’s geometry is ControlCornerRadius 4 dp for anything in the page and OverlayCornerRadius 8 dp for anything that floats (tooltips excepted — they float but round at 4). Interactive controls share a 32 dp height. The type ramp specifies zero letter-spacing at every rung: Fluent’s size-appropriate texture comes from Segoe UI Variable’s optical-size axis, not from tracking — the opposite of Material 3.

§Accent colour

AccentFillColor* is not a literal in WinUI’s dictionary; it binds to the ramp Windows generates from the user’s chosen accent. light and dark resolve it against the Windows out-of-box #0078D4; light_with_accent / dark_with_accent rebuild the whole theme around a different seed, so an app that reads the live Windows accent — or wants a brand colour — stays Fluent everywhere else.

§Known limitations

  • Mica and Acrylic are their solid fallbacks. Both are compositor materials: Mica samples the desktop wallpaper, Acrylic blurs what is behind the window. Neither is expressible in a flat-fill renderer, and Teksilo’s wgpu surface does not expose compositor-side blur. Every surface therefore uses the opaque fallback WinUI itself falls back to when the material is unavailable — which is the documented behaviour on a machine with transparency effects off, not an approximation.
  • Segoe UI Variable cannot be bundled. It is proprietary, so the default build keeps the metric-neutral bundled Inter and the system-fonts feature names the Windows faces for the text engine to resolve. See typography.
  • The accent ramp is reconstructed, not published. Microsoft documents that Windows generates SystemAccentColorLight1..3 / Dark1..3 from the base accent but not how. palette::FluentAccentRamp::windows_default carries the measured values for #0078D4; from_base approximates the curve for any other seed.
  • Widget chrome is chosen at build time. Switching between Fluent and another preset at runtime re-tints instantly but keeps the shapes the tree was built with — a property of the styling system, not of this preset.

Re-exports§

pub use palette::FluentAccentRamp;
pub use palette::FluentEdgeSide;
pub use palette::FluentPalette;

Modules§

motion
Fluent motion tokens.
palette
The WinUI 3 theme-resource palette, attached to the theme as a typed extension.
shape
Fluent shape tokens — corner radii, stroke widths, focus geometry and elevation shadows.
styles
Fluent Tier-3 widget styles, installed into the theme’s style_slots by crate::light / crate::dark.
typography
Fluent typography — the WinUI 3 type ramp mapped onto Teksilo’s six TextStyle slots.

Functions§

dark
Fluent dark theme, on the Windows default accent #0078D4.
dark_with_accent
Fluent dark theme rebuilt around accent.
light
Fluent light theme, on the Windows default accent #0078D4.
light_with_accent
Fluent light theme rebuilt around accent — the substitution Windows performs when the user picks an accent colour.