format

Function format 

Source
pub fn format(message: &str) -> String
Expand description

Format a string with ANSI escape sequences.

Parse color anchor by detecting if there is a color anchor and then replace it with ANSI escape sequence. If there is a invalid color anchor (eg. “[$not_a_color]”), it will panic.

§Example:

let f = vari::format("[$cyan]Hi![$/]");
assert_eq!(f, "\x1b[36mHi!\x1b[0m");