Macro term_ansi::apply_color
source · macro_rules! apply_color { ($color_code:expr, $($arg:tt)*) => { ... }; }
Expand description
Applies a color code to the provided format string.
§Arguments
color_code- The ANSI escape code for the desired color.args- The format string and its arguments.
§Example
use term_ansi::*;
let colored_text = apply_color!("\x1b[31m", "This is {}", "red");
println!("{}", colored_text);§Notes
The color context is managed using ColorContext to ensure colors are correctly nested.