Stilo
A small library for stylizing terminal text with ANSI color codes, with ergonomic macros.
Usage
Add stilo = "0.2.2" to your Cargo.toml dependencies
stylize!
Creates a Style struct and formats text.
use stylize;
// Red
println!;
// Red, italic, and bold
println!;
// Default color, italic and bold
println!;
// Format string
let world = "World!";
println!;
stylize_many! and println!_styles!
Stylize many strings individually, and concatenate.
stylize_many!: Returns aStringof formatted textprintln_styles!: Prints aStringof formatted text to stdout, with newline.-
- Same as
println!("{}", stylize_many!( ... ))
- Same as
use stylize_many;
let world = "World!";
// `println!("{}", stylize_many!` would also work in this example
println_styles!;
style!
Creates a Style struct, without formatting text.
// Red
let style = style!;
println!;
// Red, italic, and bold
let style = style!;
println!;
// Default color, italic and bold
let style = style!;
println!;
No macros
use ;
// Create a new style with the builder pattern
// `Style` implements `Copy`
let style = new.color.italic;
// OOP Syntax
println!;
// Functional syntax
println!;