Skip to main content

system_is_dark

Function system_is_dark 

Source
pub fn system_is_dark() -> bool
Expand description

Detect whether the system is using a dark color scheme.

Uses synchronous, platform-specific checks so the result is available immediately at window creation time (before any async portal response). The result is cached after the first call using OnceLock.

§Fallback chain

  1. gsettings get org.gnome.desktop.interface color-scheme — works on all DEs that implement the freedesktop color-scheme setting (GNOME, KDE 5.x+, XFCE, etc.).
  2. (with kde feature) ~/.config/kdeglobals background luminance.
  3. Returns false (light) if neither source is available.