Crates.io | bright |
lib.rs | bright |
version | 0.4.1 |
source | src |
created_at | 2019-06-17 08:17:28.365934 |
updated_at | 2021-05-20 03:08:18.033707 |
description | Beautiful terminal color |
homepage | https://github.com/wyhaya/bright |
repository | https://github.com/wyhaya/bright.git |
max_upload_size | |
id | 141694 |
size | 14,490 |
Beautiful terminal color
Add this in your Cargo.toml
:
[dependencies]
bright = "*"
use bright::*;
use std::io::{stdout, Write};
fn main() {
println!("{}", "Hello world".bold().red().bg_green());
// stdout
let ansi = Bright::new("Hello world").red().to_string();
stdout().write(ansi.as_bytes());
}
.bold()
.dim()
.italic()
.underline()
.slow_blink()
.fast_blink()
.invert()
.hidden()
.cross_out()
.black()
.red()
.green()
.yellow()
.blue()
.magenta()
.cyan()
.white()
.rgb(r, g, b)
.bg_black()
.bg_red()
.bg_green()
.bg_yellow()
.bg_blue()
.bg_magenta()
.bg_cyan()
.bg_white()
.bg_rgb(r, g, b)