pub fn subscribe() -> Result<Watcher, Error>Expand description
Subscribes to changes in the system theme mode.
Returns a Watcher that receives a new Mode each time the OS theme changes.
Only mode transitions are emitted, and the watcher’s background thread (where used)
stops when the Watcher is dropped.
§Example
use dark_light::{ Error, Mode };
fn main() -> Result<(), Error> {
let watcher = dark_light::subscribe()?;
for mode in watcher.iter() {
match mode {
Mode::Dark => {},
Mode::Light => {},
Mode::Unspecified => {},
}
}
Ok(())
}