Expand description
Cross-platform OS appearance (dark/light) detection.
We hand-roll this so we don’t depend on dark-light, which in v2.x
pulls in the now-unmaintained async-std (RUSTSEC-2025-0052).
Per AGENTS.md §4: dark + light mode follow MUST work on Windows, macOS, and Linux without third-party crates beyond the standard ecosystem. The Python reference implementation (the previous generation of this tool) demonstrated that the algorithm fits in about thirty lines per platform; this is the Rust translation.
Precedence:
NO_COLOR->Appearance::Unknown(let caller decide).COLORFGBG-> parsed foreground;background colours.- Per-OS native probe -> Windows registry / macOS
defaults/ GNOME gsettings / KDEkdeglobals. - Fallback ->
Appearance::Unknown.
Enums§
- Appearance
- Theme
Choice - User-visible theme preference, stored in the config file as a string
(
"auto","dark","light"). A string is used on disk so older configs (and hand-edited files with typos) keep loading; unknown values silently fall back toThemeChoice::Auto.
Functions§
- detect
- Best-effort current OS appearance.