Macro stilo::style

source ·
macro_rules! style {
    ( $color: ident ) => { ... };
    ( $color: ident $( $decor: ident )* ) => { ... };
    ( - $( $decor: ident )* ) => { ... };
}
Expand description

Creates a Style struct, without formatting text.

Similar to Style struct builder pattern.

Examples

// 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"));