update condition

This commit is contained in:
yggverse 2024-12-08 11:14:46 +02:00
parent 5626757376
commit 390f4b5f7a

View File

@ -12,14 +12,15 @@ pub fn format(source_code: &str) -> Vec<(TextTag, String)> {
let mut tag = Tag::new();
for ref entity in source_code.ansi_parse() {
if let Output::Escape(AnsiSequence::SetGraphicsMode(colors)) = entity {
if colors.len() == 1 {
} else if colors[0] == 38 {
tag.text_tag
.set_foreground_rgba(rgba::default(*colors.last().unwrap()).as_ref());
} else {
tag.text_tag
.set_background_rgba(rgba::default(*colors.last().unwrap()).as_ref());
if let Output::Escape(AnsiSequence::SetGraphicsMode(color)) = entity {
if color.len() > 1 {
if color[0] == 38 {
tag.text_tag
.set_foreground_rgba(rgba::default(*color.last().unwrap()).as_ref());
} else {
tag.text_tag
.set_background_rgba(rgba::default(*color.last().unwrap()).as_ref());
}
}
}
if let Output::TextBlock(text) = entity {