ansiform

Crates.ioansiform
lib.rsansiform
version0.1.1
sourcesrc
created_at2020-08-28 13:02:30.772462
updated_at2020-10-16 17:31:39.974729
descriptionEasily format strings with ANSI colors
homepage
repositoryhttps://github.com/spenserblack/ansiform
max_upload_size
id281876
size22,721
Toothbrush (toothbrush7777777)

documentation

README

AnsiForm

Crates.io Docs.rs Crates.io Build Status

Easily format strings with ANSI colors

This crate provides a macro for coloring strings, allowing ANSI colors to be set at compile time instead of runtime.

Example

use ansiform::ansi;

println!(ansi!("It {;green,bold}!"), "works");
println!(ansi!("Warning: {:#?;yellow}!"), Some("warning"));

Features

This crate should support all format options defined in std::fmt. If it's missing something (and it probably will before v1.0.0), submit an Issue or PR!

After defining formatting (like :? or :#?), you define modifiers with ;option. You can add multiple modifiers separated by ,. So, to print debug format in underlined italic red, {:?;underline,red,italic}.

Options

Styles

  • bold
  • faint
  • italic
  • underline

Foreground Colors

  • black
  • red
  • green
  • yellow
  • blue
  • magenta
  • cyan
  • white
  • bright black
  • gray
  • grey
  • bright red
  • bright green
  • bright yellow
  • bright blue
  • bright magenta
  • bright cyan
  • bright white

Background Colors

  • on black
  • on red
  • on green
  • on yellow
  • on blue
  • on magenta
  • on cyan
  • on white
  • on bright black
  • on gray
  • on grey
  • on bright red
  • on bright green
  • on bright yellow
  • on bright blue
  • on bright magenta
  • on bright cyan
  • on bright white
Commit count: 90

cargo fmt