A small library for stylizing terminal text with ANSI color codes, with ergonomic macros.
Add stilo = "0.2.0"
to your Cargo.toml
dependencies
Creates a Style
struct and formats text.
```rust use stilo::stylize;
// Red println!("{}", stylize!("Hello": Red));
// Red, italic, and bold println!("{}", stylize!("Hello": Red italic bold));
// Default color, italic and bold println!("{}", stylize!("Hello": - i b));
// Format string let world = "World!"; println!("{}", stylize!("Hello {}": Green i b, world)); ```
Stylize many strings individually, and concatenate.
```rust use stilo::stylize_many; let world = "World!";
println!("{}", stylize_many!( // Red "Hello\n": Red; // Red, italic, and bold "Hello\n": Red italic bold; // Default color, italic and bold "Hello\n": - i b; // Format string "Hello {}": Green i b, world; )); ```
Creates a Style
struct, without formatting text.
```rust // Red let style = style!(Red); println!("{}", style.format("Hello"));
// Red, italic, and bold let style = style!(Red italic bold); println!("{}", style.format("Hello"));
// Default color, italic and bold let style = style!(- i b); println!("{}", style.format("Hello")); ```