Vari (Väri) is a Rust library for formatting strings with colors and cosmetic stuff to the terminal. Like Rich library for Python.
toml
[dependencies]
vari = "0.1.5"
```rust fn main() { // [$/] is shorthand for [$reset] let message = vari::format("[$blue]Hello, [$green]World![$/]"); println!("{}", message);
// Custom RGB!
println!("{}", vari::format("[$[114, 119, 39]]#727727![$[66, 4, 32]] Do you see it?[$/]"));
// Style anchor!
vprintln!("{}Bold and Italic :O{}", "[$bold][$italic]", "[$/]");
// Background color
vprintln!("{}Backgroundssss{}[$/]", "[bg$magenta]", "[bg$[188, 188, 188]]World![$/]")
} ```
``rust
fn main() {
// We are using
vformat!()because
format!()` is from Rust and we can't replace it
let f = vformat!("{}Hello!{}", "[$bright_magenta]", "[$/]");
println!("{}", f);
// Feeling lazy? there is vprint! and vprintln! macros!
vprintln!("{}I'm feeling {}{}", "[$italic][$yellow]", "lazy" "$[/]");
} ```
rust
fn main() {
// Rainbow colors!
println!("{}", vari::fun::rainbow("Rainbow!!!"));
}
This crate is under AGPL-3.0 license.