pub fn background_color(options: QueryOptions) -> Result<Color>
Expand description

Queries the terminal for it’s background color.
If you also need the foreground color it is more efficient to use color_scheme instead.

§Caveats

Extra care needs to be taken on Unix if your program might share the terminal with another program. This might be the case if you expect your output to be used with a pager e.g. your_program | less. In that case, a race condition exists because the pager will also set the terminal to raw mode. The pager example shows a heuristic to deal with this issue.

Examples found in repository?
examples/bg.rs (line 7)
6
7
8
9
10
fn main() -> Result<(), Box<dyn Error>> {
    let fg = background_color(QueryOptions::default())?;
    println!("rgb({}, {}, {})", fg.r >> 8, fg.g >> 8, fg.b >> 8);
    Ok(())
}