Macro stilo::stylize_many
source · macro_rules! stylize_many { ( $( $text: literal $( : $( $color: ident )? $( + $decor: ident )* $( if $condition: expr )? )? $(, $arg: expr )* $(,)? );* $(;)? ) => { ... }; ( $( $text: literal $( : $( $style: block )? $( if $condition: expr )? )? $(, $arg: expr )* $(,)? );* $(;)? ) => { ... }; }
Expand description
Stylize many strings individually, and concatenate.
Similar: println_styles!
For each argument, creates a Style
struct and format text.
Separate arguments with a semicolon. New lines will not be added between arguments.
Each argument is used the same as the stylize!
macro.
Examples
let world = "World!";
// `println_styles!` would also work in this example
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;
));