Open
Description
I get the ansi string from another process and display it in my rich text box, so I need to parse the ansi control codes.
Now I use AnsiCodeIterator to get each element, is there a way to parse it to get what kind of style it is?
fn main() {
let ansi_str = style("Hello world!").force_styling(true).red().on_blue().bold().to_string();
println!("{:?}", ansi_str);
AnsiCodeIterator::new(&ansi_str).for_each(|ansi_code| {
println!("{:?}", ansi_code.0);
// how to convert ansi code to style?
// such as let style = Style::from_ansi_code(ansi_code.0);
// but this method is not implemented
});
}
Metadata
Metadata
Assignees
Labels
No labels