Skip to main content

Module theme

Module theme 

Source
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:

  1. NO_COLOR -> Appearance::Unknown (let caller decide).
  2. COLORFGBG -> parsed foreground;background colours.
  3. Per-OS native probe -> Windows registry / macOS defaults / GNOME gsettings / KDE kdeglobals.
  4. Fallback -> Appearance::Unknown.

Enums§

Appearance

Functions§

detect
Best-effort current OS appearance.