Crates.io | ttycolor |
lib.rs | ttycolor |
version | 0.1.3 |
source | src |
created_at | 2021-07-25 16:16:07.827939 |
updated_at | 2024-03-22 10:07:08.417698 |
description | easy way to use termcolor |
homepage | |
repository | https://github.com/develon2015/ttycolor |
max_upload_size | |
id | 427111 |
size | 10,429 |
Easy way to use termcolor.
cargo.toml
[dependencies]
ttycolor = "0.1.0" # easy way to use termcolor
main.rs
extern crate ttycolor;
use ttycolor::ColorTrait;
fn main() {
let str = "Warning";
println!("{}: xxxxxx", str.red());
println!("{}: xxxxxx", str.fg(ttycolor::rgb(0, 255, 0)));
println!("{}: xxxxxx", str.cyan().bold());
println!("{}: xxxxxx", str.white().bg_magenta().bold().italic().underline());
println!("{}: xxxxxx", String::from(str).red());
println!("{}: {}", str.green(), format!("{:018p}", str).red());
}