colorize-rs

Crates.iocolorize-rs
lib.rscolorize-rs
version0.1.2
created_at2025-01-26 18:58:37.50242+00
updated_at2025-01-26 19:09:51.400643+00
descriptionSimple terminal text colorisation using ansi characters
homepagehttps://github.com/MOBSkuchen/colorize-rs
repositoryhttps://github.com/MOBSkuchen/colorize-rs
max_upload_size
id1531626
size23,027
(MOBSkuchen)

documentation

README

colorize-rs

A fork of colorize https://github.com/jeremyletang/colorize

cargo add colorize-rs

colorize-rs provide simple text colorization for terminal emulator, using ansi escape characters.

Look at this example:

extern crate colorize_rs;
use colorize_rs::{AnsiColor, Color};

pub fn main() {
    // Set some global colors
    colorize_rs::global_fg(Color::Blue);
    colorize_rs::global_bg(Color::Red);
    // ^~~~ 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: 54

cargo fmt