fix: dependencies update
update colorize_logs with updated cansi methods
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
pub mod log_sanitizer {
|
pub mod log_sanitizer {
|
||||||
|
|
||||||
use cansi::{categorise_text, Color as CansiColor, Intensity};
|
use cansi::{v3::categorise_text, Color as CansiColor, Intensity};
|
||||||
use tui::{
|
use tui::{
|
||||||
style::{Color, Modifier, Style},
|
style::{Color, Modifier, Style},
|
||||||
text::{Span, Spans},
|
text::{Span, Spans},
|
||||||
@@ -12,25 +12,25 @@ pub mod log_sanitizer {
|
|||||||
categorise_text(&input)
|
categorise_text(&input)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|i| {
|
.map(|i| {
|
||||||
let fg_color = color_ansi_to_tui(i.fg_colour);
|
let fg_color = color_ansi_to_tui(i.fg.unwrap_or(CansiColor::White));
|
||||||
let bg_color = color_ansi_to_tui(i.bg_colour);
|
let bg_color = color_ansi_to_tui(i.bg.unwrap_or(CansiColor::Black));
|
||||||
let style = Style::default().bg(bg_color).fg(fg_color);
|
let style = Style::default().bg(bg_color).fg(fg_color);
|
||||||
if i.blink {
|
if i.blink.is_some() {
|
||||||
style.add_modifier(Modifier::SLOW_BLINK);
|
style.add_modifier(Modifier::SLOW_BLINK);
|
||||||
}
|
}
|
||||||
if i.underline {
|
if i.underline.is_some() {
|
||||||
style.add_modifier(Modifier::UNDERLINED);
|
style.add_modifier(Modifier::UNDERLINED);
|
||||||
}
|
}
|
||||||
if i.reversed {
|
if i.reversed.is_some() {
|
||||||
style.add_modifier(Modifier::REVERSED);
|
style.add_modifier(Modifier::REVERSED);
|
||||||
}
|
}
|
||||||
if i.intensity == Intensity::Bold {
|
if i.intensity == Some(Intensity::Bold) {
|
||||||
style.add_modifier(Modifier::BOLD);
|
style.add_modifier(Modifier::BOLD);
|
||||||
}
|
}
|
||||||
if i.hidden {
|
if i.hidden.is_some() {
|
||||||
style.add_modifier(Modifier::HIDDEN);
|
style.add_modifier(Modifier::HIDDEN);
|
||||||
}
|
}
|
||||||
if i.strikethrough {
|
if i.strikethrough.is_some() {
|
||||||
style.add_modifier(Modifier::CROSSED_OUT);
|
style.add_modifier(Modifier::CROSSED_OUT);
|
||||||
}
|
}
|
||||||
Span::styled(i.text.to_owned(), style)
|
Span::styled(i.text.to_owned(), style)
|
||||||
|
|||||||
Reference in New Issue
Block a user