Follow the desktop accent colour and colour scheme (XDG portal)
CI / check (pull_request) Successful in 10s
CI / native (pull_request) Successful in 1m18s

Read org.freedesktop.appearance accent-color and color-scheme from
org.freedesktop.portal.Settings over GDBus in the GTK stub and follow
SettingChanged. The accent recolours the selected tab, sliders, peak
meters and the checked Default button through an application-priority
GtkCssProvider (named colours and --accent-* variables too, for themes
that use them); the colour scheme sets the theme's dark/light variant.
Without a portal or accent the theme's own stays.

Colour conversion, WCAG contrast (readable foreground on the accent,
readable accent text on the window) and the CSS live in model/accent.mbt
with unit tests. The smoke test runs a fake portal on a private session
bus, switches the accent live from green to orange and renders the tabs
again (docs/screenshots/accent-*.png).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
SpriteandClaude Opus 5.5 committed 2026-11-23 01:28:19 +00:00
1 parent bc675459d9
commit 74d85ecdfc
16 files changed
+947 -12

No files matched your search

+13
View File
@@ -24,6 +24,8 @@ pub fn notebook(on_switch? : (Int32) -> Unit) -> Widget
pub fn now_us() -> Int64
pub fn prefers_dark() -> Bool
pub fn quit() -> Unit
pub fn resolve_icon(Array[String]) -> String
@@ -36,6 +38,10 @@ pub fn scrolled(Widget) -> Widget
pub fn separator() -> Widget
pub fn set_accent_css(String) -> Unit
pub fn set_color_scheme(Int32) -> Unit
pub fn timeout(Int32, () -> Unit) -> Unit
pub fn toggle(String, String, (Bool) -> Unit) -> (Widget, Int32)
@@ -46,11 +52,18 @@ pub fn updating(() -> Unit) -> Unit
pub fn vbox(Int32) -> Widget
pub fn watch_appearance((Appearance) -> Unit) -> Bool
pub fn window(String, Int32, Int32, on_close? : () -> Unit) -> Widget
// Errors
// Types and methods
pub(all) struct Appearance {
accent : (Double, Double, Double)
color_scheme : Int32
}
#external
pub type Widget
pub fn Widget::add_css_class(Self, String) -> Unit