colorize

Crates.iocolorize
lib.rscolorize
version0.1.0
sourcesrc
created_at2016-07-01 16:45:50.850924
updated_at2016-07-01 16:45:50.850924
descriptionSimple terminal text colorisation using ansi characters
homepagehttps://github.com/jeremyletang/colorize
repositoryhttps://github.com/jeremyletang/colorize
max_upload_size
id5557
size23,263
Jeremy Letang (jeremyletang)

documentation

README

colorize

libcolorize provide simple text colorization for terminal emulator, using ansi escape characters.

To build libcolorize just do :

> rustc lib.rs

libcolorize is really simple to use, see this short example !

extern crate colorize;
// Import the trait implemented for &'static str and ~str
use colorize::AnsiColor;
// Import the colors for the global
use colorize::{BrightRed, Blue};

pub fn main() {
    // Set some global colors
    colorize::global_fg(BrightRed);
    colorize::global_bg(Blue);
    // ^~~~ These settings are reset to default at the end.

    // You can use specific colors or style on a given str,
    // the globals colors are restored after !

    // Write a green underlined text on a yellow background !
    println!("{}", "Hello World !".green().underlined().yellowb());

    // Use bright or normal colors
    println!("{}", "Bright Green foreground and Magenta background !".b_green().magentab());
}

Commit count: 44

cargo fmt