Skip to main content

Theming and the Look

Taunus has no fixed colour scheme. The wallpaper is generated on the device, and every colour of the system is derived from it: the accent, the surfaces, the text. Apps take part by using the Theme global and applying the current Look to it.

In Slint​

Use tokens, never literal colours or sizes:

Rectangle {
background: Theme.surface;
border-radius: Theme.radius-group;
Text { text: @tr("x.title"); color: Theme.text; font-size: Theme.headline; }
}

The full list is in Tokens.

In Rust​

CallDoes
Look::current((w, h))The current wallpaper, its colours and the user's text size and animations setting. Slow (renders the wallpaper): call it on a worker thread.
Look::colours(seed)Only the colours, no wallpaper image: fast, for apps without a wallpaper background
taunus_theme::apply!(ui.global::<Theme>(), &look)Writes a Look into a window's Theme. UI thread.
taunus_theme::apply_text_scale!(…), apply_animations!(…)Only that part
taunus_theme::attach!(ui)Once per window: form factor, focus engine, Back, on-screen keyboard insets

Slint globals belong to one window: a second window needs its own apply! and attach!.

Live changes​

Today the shell and Settings follow changes of the wallpaper, text size and animations while they run; other apps pick them up when they start.

//2bi: the theme follows changes in every app by itself: attach! subscribes the window to a settings broadcast from the shell, and no app needs code for it.

High contrast, text size, animations​

These come with the Look. A layout must survive the largest text size (Largest, ×1.9): use layouts that grow, overflow: elide for single lines and wrap: word-wrap for text that can take more lines. Theme.animations is false when the user turned transitions off; theme widgets respect it, and own animations should use Theme.fast / Theme.normal / Theme.slow, which become 0 then.