pub struct Formatter<'a> { /* private fields */ }
Expand description
Heavier formatter that allows the possibility of
custom styles in strings. That is the only reason
this struct exists, if you don’t need custom things
just use the colorize_string()
function provided
in the module.
Implementations§
source§impl<'a> Formatter<'a>
impl<'a> Formatter<'a>
sourcepub fn new_style(&mut self, key: &str, colors: Vec<&'a str>) -> &mut Self
pub fn new_style(&mut self, key: &str, colors: Vec<&'a str>) -> &mut Self
Tell the formatter that you want a new style and what colors that style equates to so it knows what to replace it with when formatting
Example
use paris::formatter::Formatter;
let mut fmt = Formatter::new();
fmt.new_style("lol", vec!["green", "bold", "on_blue"]);
// '<lol>' is now a key that can be used in strings