Skip to content

wyhaya/bright

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)