colorant 0.8.0

Per-directory terminal theme switcher with system dark/light mode support
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! `colorant reset` — emit OSC sequences resetting fg, bg, cursor, and the
//! 16-color palette to terminal defaults. Also resets the tab color on
//! terminals that support one (iTerm2 today).

use crate::terminal::{osc, utils};
use anyhow::Result;
use std::io::stdout;

pub fn run() -> Result<()> {
    let Some(terminal) = utils::detect() else {
        return Ok(());
    };

    let mut out = stdout().lock();
    osc::emit_reset(&mut out, terminal)?;
    Ok(())
}