Display nicks with hashed color

This commit is contained in:
Joscha 2022-07-02 17:23:30 +02:00
parent 37d10821a4
commit 11422801b0
8 changed files with 92 additions and 6 deletions

View file

@ -3,6 +3,7 @@ use std::vec;
use async_trait::async_trait;
use chrono::{DateTime, Utc};
use crossterm::style::{ContentStyle, Stylize};
use log::{Level, Log};
use parking_lot::Mutex;
use tokio::sync::mpsc;
@ -36,6 +37,16 @@ impl Msg for LogMsg {
format!("{}", self.level)
}
fn nick_style(&self) -> ContentStyle {
match self.level {
Level::Error => ContentStyle::default().bold().red(),
Level::Warn => ContentStyle::default().bold().yellow(),
Level::Info => ContentStyle::default().bold().green(),
Level::Debug => ContentStyle::default().bold().blue(),
Level::Trace => ContentStyle::default().bold().magenta(),
}
}
fn content(&self) -> String {
self.content.clone()
}