Skip to main content

Crate teksilo_theme_macos

Crate teksilo_theme_macos 

Source
Expand description

macOS (Aqua / Dark Aqua) theme preset for Teksilo.

A full macOS theme: the AppKit semantic-colour palette, the two measured radii, the published San Francisco type ramp with its signed tracking, Core Animation’s default duration and curve, and Tier-3 chrome for the widgets whose AppKit counterpart is structurally its own thing.

ⓘ
use teksilo_theme_macos as macos;

TeksiloAppBuilder::new()
    .theme(macos::light())
    .initial_window(WindowConfig::new().title("macOS demo"))
    .run();

§What makes it read as macOS

  • The focus ring is the accent. Not a neutral high-contrast outline (Fluent) and not a thickened border (Material 3) — the user’s own accent colour, as a soft halo hugging the control’s outline. See shape for how the halo is built so it still clears WCAG 1.4.11.
  • Controls are physical objects. A push button, a popup button, a switch knob and a slider knob all share one bezel: a faint top-to- bottom gradient, a hairline, and a shadow that separates it from the surface underneath. Big Sur flattened Aqua’s gloss but kept all three, and it is what stops a macOS control reading as a coloured rectangle.
  • Selection is a capsule, and its label turns white. A selected list row is an accent-filled rounded capsule inset from the row’s edges, with alternateSelectedControlTextColor on top. Menus do the same. This is the most recognisable single element of a macOS list.
  • Signed tracking. Small text is loosened, larger text tightened, crossing zero at 12 pt — the only Teksilo preset that tracks non-uniformly, and a published Apple table rather than a guess.
  • Denser than Fluent. A 22 dp control height against Windows 11’s 32, and a 13 pt body against 14. macOS fits more in the same window.
  • Symmetric motion. ease-in-ease-out rather than Fluent’s decelerate-only curve: things start gently and stop gently.

§Accent colour

controlAccentColor is whatever the user picked in System Settings. light and dark resolve it against the out-of-box systemBlue; light_with_accent / dark_with_accent rebuild the whole theme around a different seed, and SystemAccent carries the eight swatches macOS itself offers:

ⓘ
use teksilo_theme_macos::{self as macos, SystemAccent};
let theme = macos::light_with_accent(SystemAccent::Purple.light());

Note that linkColor deliberately does not follow: AppKit keeps links a fixed blue whatever accent is chosen, and so does this preset.

§Known limitations

  • The OS accent is not read. Teksilo’s platform layer returns only the light/dark preference on macOS — query_os_theme_colors fills in the colour scheme and nothing else — so there is no live NSColor.controlAccentColor to bind to. The preset ships the stock blue and an app that wants the user’s real accent passes it to light_with_accent itself. Wiring the AppKit read is a platform-layer change, not a theme one.
  • Vibrancy is its opaque fallback. Sidebars, menus, popovers and title bars are NSVisualEffectView materials that sample and blur what is behind the window; Teksilo’s wgpu surface exposes no compositor-side blur, so every such surface uses the opaque colour the material falls back to — which is what macOS itself shows with “Reduce transparency” on, not an invention. (Teksilo’s Blur primitive can blur content within a window, so a popover over the app’s own content is expressible; sampling the desktop wallpaper is not.)
  • The table selection band is a wash, not a capsule. ListView and TreeView rows get the authentic solid-accent capsule with a white label, because styles::standard_item owns both halves. TableView / TreeTableView / GridView paint the shared surface_selected token behind app-supplied cell widgets whose text this preset cannot retint, so that token is the accent as a wash the primary label still clears 4.5:1 on. Fluent makes the same split for the same reason.
  • Several literals are snapshots. Apple’s own standing disclaimer is that published colour values “will fluctuate from release to release”; control heights, corner radii, focus-ring geometry and every animation duration but one are not published at all. Each value in this crate is tagged [HIG], [measured] or [derived] at its definition, and the handful that deviate from Apple’s own numbers to meet WCAG are called out with the measurement that forced the change.
  • Window activation is two-state, AppKit’s is three. Teksilo models a window as active or not; AppKit distinguishes Main, Key and Inactive (a document window stays Main while its sheet is Key). The accent desaturation this preset inherits fires on the Teksilo boundary, which matches AppKit for every case except that one.
  • Widget chrome is chosen at build time. Switching between macOS 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::MacOsAccentRamp;
pub use palette::MacOsBezel;
pub use palette::MacOsPalette;
pub use palette::SystemAccent;

Modules§

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

Functions§

dark
macOS Dark Aqua, on the stock systemBlue accent.
dark_with_accent
Dark Aqua rebuilt around accent.
light
macOS Aqua (light), on the stock systemBlue accent.
light_with_accent
Aqua rebuilt around accent — the substitution macOS performs when the user picks an accent colour in System Settings.