mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-28 12:04:13 +00:00
update condition
This commit is contained in:
parent
5626757376
commit
390f4b5f7a
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user