Use color overrides for users when message_user_color is enabled (#245)

This commit is contained in:
Ulyssa 2024-04-02 08:42:27 -07:00 committed by GitHub
parent 0f17bbfa17
commit e5b284ed19
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 6 deletions

View file

@ -912,15 +912,16 @@ impl ApplicationSettings {
.unwrap_or_default()
}
pub fn get_user_style(&self, user_id: &UserId) -> Style {
let color = self
.tunables
pub fn get_user_color(&self, user_id: &UserId) -> Color {
self.tunables
.users
.get(user_id)
.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> {

View file

@ -863,7 +863,7 @@ impl Message {
}
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);
}