1 unstable release

Uses old Rust 2015

0.1.0 Jul 1, 2016

#831 in Command-line interface

Download history 141/week @ 2023-12-05 190/week @ 2023-12-12 304/week @ 2023-12-19 158/week @ 2023-12-26 161/week @ 2024-01-02 264/week @ 2024-01-09 203/week @ 2024-01-16 326/week @ 2024-01-23 378/week @ 2024-01-30 365/week @ 2024-02-06 412/week @ 2024-02-13 198/week @ 2024-02-20 308/week @ 2024-02-27 246/week @ 2024-03-05 262/week @ 2024-03-12 294/week @ 2024-03-19

1,155 downloads per month
Used in 20 crates (14 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