Crates.io | cli-colors |
lib.rs | cli-colors |
version | 1.0.0 |
source | src |
created_at | 2024-08-25 14:36:20.904898 |
updated_at | 2024-08-25 14:36:20.904898 |
description | A CLI tool for outputting text in ANSI format with features like colors, underlining, boldening, and italicizing |
homepage | |
repository | https://github.com/BrianTib/cli-color |
max_upload_size | |
id | 1351146 |
size | 14,242 |
cli-colors is a Rust library that provides a simple way to add ANSI color and formatting to your command-line interface (CLI) applications. With cli-color, you can easily add underlines, bold text, italics, and various colors to your CLI output.
Add this to your Cargo.toml
:
[dependencies]
cli-colors = "1.0.0"
Here's a quick example of how to use cli-colors:
use cli_colors::Colorizer;
fn main() {
let colorizer = Colorizer::new();
println!("{}", colorizer.black("Black"));
println!("{}", colorizer.blue("Blue"));
println!("{}", colorizer.bold("Bold"));
println!("{}", colorizer.bright_black("Bright Black"));
println!("{}", colorizer.bright_red("Bright Red"));
println!("{}", colorizer.cyan("Cyan"));
println!("{}", colorizer.green("Green"));
println!("{}", colorizer.italic("Italic"));
println!("{}", colorizer.magenta("Magenta"));
println!("{}", colorizer.red("Red"));
println!("{}", colorizer.strikethrough("Strikethrough"));
println!("{}", colorizer.underline("Underline"));
println!("{}", colorizer.white("White"));
println!("{}", colorizer.yellow("Yellow"));
println!("{}", colorizer.rgb("Custom", 255, 0, 255));
println!("{}", colorizer.rainbow("THIS IS A PRETTY RAINBOW WOOT WOOT"));
println!("{}", colorizer.bg_rainbow("THIS IS A PRETTY RAINBOW WOOT WOOT"));
}
This project is licensed under the MIT