mirror of
https://github.com/youwen5/iamb.git
synced 2025-06-19 21:29:52 -07:00
Use color overrides for users when message_user_color
is enabled (#245)
This commit is contained in:
parent
0f17bbfa17
commit
e5b284ed19
2 changed files with 7 additions and 6 deletions
|
@ -912,15 +912,16 @@ impl ApplicationSettings {
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_user_style(&self, user_id: &UserId) -> Style {
|
pub fn get_user_color(&self, user_id: &UserId) -> Color {
|
||||||
let color = self
|
self.tunables
|
||||||
.tunables
|
|
||||||
.users
|
.users
|
||||||
.get(user_id)
|
.get(user_id)
|
||||||
.and_then(|user| user.color.as_ref().map(|c| c.0))
|
.and_then(|user| user.color.as_ref().map(|c| c.0))
|
||||||
.unwrap_or_else(|| user_color(user_id.as_str()));
|
.unwrap_or_else(|| user_color(user_id.as_str()))
|
||||||
|
}
|
||||||
|
|
||||||
user_style_from_color(color)
|
pub fn get_user_style(&self, user_id: &UserId) -> Style {
|
||||||
|
user_style_from_color(self.get_user_color(user_id))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_user_span<'a>(&self, user_id: &'a UserId, info: &'a RoomInfo) -> Span<'a> {
|
pub fn get_user_span<'a>(&self, user_id: &'a UserId, info: &'a RoomInfo) -> Span<'a> {
|
||||||
|
|
|
@ -863,7 +863,7 @@ impl Message {
|
||||||
}
|
}
|
||||||
|
|
||||||
if settings.tunables.message_user_color {
|
if settings.tunables.message_user_color {
|
||||||
let color = crate::config::user_color(self.sender.as_str());
|
let color = settings.get_user_color(&self.sender);
|
||||||
style = style.fg(color);
|
style = style.fg(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue