1 unstable release

Uses old Rust 2015

0.1.0 Jul 1, 2016

#1069 in Command-line interface

Download history 378/week @ 2024-07-19 220/week @ 2024-07-26 312/week @ 2024-08-02 608/week @ 2024-08-09 211/week @ 2024-08-16 199/week @ 2024-08-23 271/week @ 2024-08-30 357/week @ 2024-09-06 314/week @ 2024-09-13 917/week @ 2024-09-20 691/week @ 2024-09-27 740/week @ 2024-10-04 780/week @ 2024-10-11 1050/week @ 2024-10-18 848/week @ 2024-10-25 1009/week @ 2024-11-01

3,849 downloads per month
Used in 33 crates (20 directly)

22KB
385 lines

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());
}

No runtime deps