2 unstable releases

0.2.0 Nov 4, 2023
0.1.0 May 31, 2023

#717 in Command-line interface

49 downloads per month
Used in invoke-script

MIT license

14KB
130 lines

Watercolor

Docs

println!(
    "\n\t{}\n\t{}\n\t{}\n\t{}\n\t{}\n\t{}\n\t{}\n\t{}\n\t{}\n\t{}\n\t{}\n\t{}\n\t{}",
    bold("bold"),
    italic("italic"),
    dim("dim"),
    underline("underline"),
    reverse("reverse"),
    strikeout("strikeout"),
    red("red"),
    green("green"),
    on_red("on_red"),
    on_green("on_green"),
    rgb(152, 95, 111, "rgb"),
    on_rgb(152, 95, 111, "on_rgb"),
    bold(italic(underline(black(on_white("all together now"))))),
)

Screenshot of crate output


lib.rs:

Terminal styling for the rest of us who do not mind the occasional memory allocation

This is how you use the crate:

  • Call the function named for the style you want to apply.
  • Function calls can be nested
use watercolor::*;
let waow = strikeout(bold(underline(italic(red(on_green("bricks"))))));
println!("{waow}");

Use the same approach to create a "theme" that you can apply to to multiple strings.

use watercolor::*;

let very_important = bold(underline(italic(red(on_white("")))));

println!("{}", very_important.with_text("hello world"));
println!("{}", very_important.with_text("goodbye world"));

No runtime deps