[][src]Function crossterm_style::style

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

This could be used to style a type who is implementing Display with colors and attributes.


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

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

Important Remark

  • Please checkout the documentation for Colorizer or Styler. Those types will make it a bit easier to style a string.