Function crossterm::style

source ·
pub fn style<'a, D: 'a>(val: D) -> StyledObject<D>where
    D: Display,
Expand description

This could be used to style an Displayable type with colors and attributes.

extern crate crossterm;
use crossterm::Crossterm;

let crossterm = Crossterm::new();

// get an styled object which could be painted to the terminal.
let styled_object = crossterm.style("Some Blue colored text on black background")
    .with(Color::Blue)
    .on(Color::Black);

// print the styled font * times to the current screen.
for i in 1..10
{
    println!("{}", styled_object);
}