Skip to main content

scheme_of

Function scheme_of 

Source
pub fn scheme_of(color_scheme: u32) -> Scheme
Expand description

What the desktop portal’s color-scheme means, including the value that is a decision rather than a reading.

The XDG specification defines three: 0 no preference, 1 prefer dark, 2 prefer light. Zero is treated as light, and that is the whole of what makes this module work on GNOME. GNOME’s Settings offers Light and Dark and spells them default and prefer-dark, so choosing Light sets color-scheme to default and the portal answers 0 — never 2. Measured on GNOME 48.7: prefer-light has to be set by hand through gsettings and no part of the interface will do it.

So reading 0 as leave it dark would mean every GNOME user who chose Light still got the dark card, which is the defect this module was written for wearing a different hat. Reading it as light is also what GTK does with ADW_COLOR_SCHEME_DEFAULT, so an application that follows this rule looks like every other application on that desktop rather than like the one exception.

The cost is a desktop that is genuinely dark while declaring no preference, where this now draws light. That desktop’s GTK applications are drawing light too, so the answer is at least consistent with its neighbours.