| Crates.io | colorize-rs |
| lib.rs | colorize-rs |
| version | 0.1.2 |
| created_at | 2025-01-26 18:58:37.50242+00 |
| updated_at | 2025-01-26 19:09:51.400643+00 |
| description | Simple terminal text colorisation using ansi characters |
| homepage | https://github.com/MOBSkuchen/colorize-rs |
| repository | https://github.com/MOBSkuchen/colorize-rs |
| max_upload_size | |
| id | 1531626 |
| size | 23,027 |
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());
}