1
0
Fork
You've already forked dark-light
0
No description
  • Rust 85.6%
  • Just 14.4%
2025年03月13日 11:43:09 -07:00
.github/workflows Improvements to API and documentation ( #52 ) 2024年12月31日 17:45:00 +01:00
examples remove: subscribe ( #60 ) 2025年01月09日 13:12:18 -06:00
resources/icon chore: update README 2024年12月31日 15:35:36 +01:00
src chore: fix typo and modify as adjust 2025年03月13日 11:43:09 -07:00
.gitignore Notifications ( #26 ) 2024年04月13日 08:48:06 -07:00
build.rs Fix vendor detect in build script ( #19 ) 2022年04月04日 11:09:32 -05:00
Cargo.toml feat: expose zbus's async-io and tokio features 2025年03月13日 11:43:09 -07:00
justfile v2.0.0 ( #53 ) 2025年01月10日 00:58:16 +01:00
README.md v2.0.0 ( #53 ) 2025年01月10日 00:58:16 +01:00

dark-light

Rust crate to detect the system theme mode

Crates.io Version Matrix

Supports macOS, Windows, Linux, BSDs, and WebAssembly.

On Linux the XDG Desktop Portal D-Bus API is checked for the color-scheme preference, which works in Flatpak sandboxes without needing filesystem access.

API Documentation

Usage

Add to your project:

cargo add dark-light

Detect current theme mode

You can detect the current mode by using the detect function. This function returns a Mode value.

fn main()-> Result<(),dark_light::Error>{matchdark_light::detect()?{dark_light::Mode::Dark=>println!("Dark mode"),dark_light::Mode::Light=>println!("Light mode"),dark_light::Mode::Unspecified=>println!("Unspecified"),}Ok(())}

License

Licensed under either of the following licenses: