No description
- Rust 85.6%
- Just 14.4%
|
|
||
|---|---|---|
| .github/workflows | Improvements to API and documentation ( #52 ) | |
| examples | remove: subscribe ( #60 ) | |
| resources/icon | chore: update README | |
| src | chore: fix typo and modify as adjust | |
| .gitignore | Notifications ( #26 ) | |
| build.rs | Fix vendor detect in build script ( #19 ) | |
| Cargo.toml | feat: expose zbus's async-io and tokio features | |
| justfile | v2.0.0 ( #53 ) | |
| README.md | v2.0.0 ( #53 ) | |
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.
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:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)