5 releases (3 breaking)

0.4.1 May 20, 2021
0.4.0 May 15, 2020
0.3.0 Mar 2, 2020
0.2.0 Jul 1, 2019
0.1.0 Jun 17, 2019

#1432 in Command line utilities

Download history 19/week @ 2022-06-08 5/week @ 2022-06-15 5/week @ 2022-06-22 5/week @ 2022-06-29 21/week @ 2022-07-06 14/week @ 2022-07-13 9/week @ 2022-07-20 13/week @ 2022-07-27 5/week @ 2022-08-03 6/week @ 2022-08-10 8/week @ 2022-08-17 9/week @ 2022-08-24 5/week @ 2022-08-31 50/week @ 2022-09-07 16/week @ 2022-09-14 5/week @ 2022-09-21

77 downloads per month
Used in lok

MIT license

12KB
302 lines

bright

Crates.io LICENSE

preview

Beautiful terminal color

Install

Add this in your Cargo.toml:

[dependencies]
bright = "*"

Usage

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());
}

Styles

Modifiers

  • .bold()
  • .dim()
  • .italic()
  • .underline()
  • .slow_blink()
  • .fast_blink()
  • .invert()
  • .hidden()
  • .cross_out()

Colors

  • .black()
  • .red()
  • .green()
  • .yellow()
  • .blue()
  • .magenta()
  • .cyan()
  • .white()
  • .rgb(r, g, b)

Background colors

  • .bg_black()
  • .bg_red()
  • .bg_green()
  • .bg_yellow()
  • .bg_blue()
  • .bg_magenta()
  • .bg_cyan()
  • .bg_white()
  • .bg_rgb(r, g, b)

No runtime deps