Support coloring entire message with the user color (#193)

This commit is contained in:
Benjamin Grosse 2024-02-28 06:52:24 +00:00 committed by GitHub
parent 1325295d2b
commit 3ed87aae05
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 15 additions and 2 deletions

View file

@ -635,7 +635,7 @@ impl Message {
}
}
fn get_render_style(&self, selected: bool) -> Style {
fn get_render_style(&self, selected: bool, settings: &ApplicationSettings) -> Style {
let mut style = Style::default();
if selected {
@ -646,6 +646,11 @@ impl Message {
style = style.add_modifier(StyleModifier::ITALIC);
}
if settings.tunables.message_user_color {
let color = crate::config::user_color(self.sender.as_str());
style = style.fg(color);
}
return style;
}
@ -739,7 +744,7 @@ impl Message {
) -> Text<'a> {
let width = vwctx.get_width();
let style = self.get_render_style(selected);
let style = self.get_render_style(selected, settings);
let mut fmt = self.get_render_format(prev, width, info, settings);
let mut text = Text { lines: vec![] };
let width = fmt.width();