Struct clt::Style [] [src]

pub struct Style {
    // some fields omitted
}

Styles a text with ANSI styles. This styling is self contained which means that at the end of the string a reset code is issued. Examples:

use clt::{Style, Red};

let mut text = String::new();
text.push_str("hello");
let mut text_styled = Style::new(text);
text_styled.fg(Red);
println!("{}", text_styled);

Methods

impl Style
[src]

fn new(text: String) -> Style

Create one new styled string with ansi codes.

fn fg(&mut self, color: Color)

Sets the foreground color.

fn bg(&mut self, color: Color)

Sets the background color.

fn bold(&mut self, bold: bool)

Enable or disable bold mode.

fn dim(&mut self, dim: bool)

Enable or disable dim mode.

fn underline(&mut self, underline: bool)

Enable or disable underline.

Enable or disable blinking.

fn reverse(&mut self, reverse: bool)

Enable or disable inverse rendering.

Trait Implementations

impl Display for Style
[src]

fn fmt(&self, f: &mut Formatter) -> Result<()Error>

Formats the value using the given formatter.