mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 09:35:28 +00:00
update condition
This commit is contained in:
parent
5626757376
commit
390f4b5f7a
1 changed files with 9 additions and 8 deletions
|
|
@ -12,14 +12,15 @@ pub fn format(source_code: &str) -> Vec<(TextTag, String)> {
|
||||||
let mut tag = Tag::new();
|
let mut tag = Tag::new();
|
||||||
|
|
||||||
for ref entity in source_code.ansi_parse() {
|
for ref entity in source_code.ansi_parse() {
|
||||||
if let Output::Escape(AnsiSequence::SetGraphicsMode(colors)) = entity {
|
if let Output::Escape(AnsiSequence::SetGraphicsMode(color)) = entity {
|
||||||
if colors.len() == 1 {
|
if color.len() > 1 {
|
||||||
} else if colors[0] == 38 {
|
if color[0] == 38 {
|
||||||
tag.text_tag
|
tag.text_tag
|
||||||
.set_foreground_rgba(rgba::default(*colors.last().unwrap()).as_ref());
|
.set_foreground_rgba(rgba::default(*color.last().unwrap()).as_ref());
|
||||||
} else {
|
} else {
|
||||||
tag.text_tag
|
tag.text_tag
|
||||||
.set_background_rgba(rgba::default(*colors.last().unwrap()).as_ref());
|
.set_background_rgba(rgba::default(*color.last().unwrap()).as_ref());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Output::TextBlock(text) = entity {
|
if let Output::TextBlock(text) = entity {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue