#ansi-colors #color #ansi #styling #terminal

ansi_brush

Ultra lightweight ANSI styling

7 releases

0.0.31 Sep 27, 2022
0.0.23 Sep 27, 2022

#4 in #colour

24 downloads per month

MIT license

8KB
124 lines

ansi_brush

Ultra lightweight ANSI styling

Examples

use ansi_brush::Style;

fn main()  {
    println!("{} {}", "Hello,".light_cyan().bold(), "World!".reset());
    // always put "reset" LAST after each style to revert the previous line's styles
    println!(
        "{} {} {} {} {} {} {} {}",
        "Bold".bold(),
        "Faint".faint().reset(),
        "Italic".italic().reset(),
        "Underline".underline().reset(),
        "Slow Blink".slow_blink().reset(),
        "Rapid Blink".rapid_blink().reset(),
        "Reverse".reverse().reset(),
        "Strike".strike().reset()
    );
    // use conclude to stop background bleeding into next lines (try it without conclude!)
    println!("{}", "Goodbye, Mars!".bg_red().underline().italic().conclude().reset());
}

TODO

  • 8 colors
  • 16 colors
  • Macro
  • 256 colors
  • Backgrounds
  • Styling
  • RGB colors

No runtime deps