terminal-colorsaurus 1.0.3

A cross-platform library for determining the terminal's background and foreground color. It answers the question «Is this terminal dark or light?».
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//! This example shows how to retrieve the terminal's foreground color.

use terminal_colorsaurus::{foreground_color, Error, QueryOptions};

fn main() -> Result<(), display::DisplayAsDebug<Error>> {
    let fg = foreground_color(QueryOptions::default())?;
    let fg_8bit = fg.scale_to_8bit();
    println!("rgb16({}, {}, {})", fg.r, fg.g, fg.b);
    println!("rgb8({}, {}, {})", fg_8bit.0, fg_8bit.1, fg_8bit.2);
    Ok(())
}

#[path = "../examples-utils/display.rs"]
mod display;