Commit c89590b662
Unsigned
Layout: unified · split
src/render.rs +22 −9
| @@ -72,11 +72,14 @@ pub fn render_membership( | |||
| 72 | _ => ("quit", "red"), | 72 | _ => ("quit", "red"), |
| 73 | }; | 73 | }; |
| 74 | 74 | ||
| 75 | let color_action = Weechat::color(color_action); | ||
| 76 | let color_reset = Weechat::color("reset"); | ||
| 77 | |||
| 75 | let operation = format!( | 78 | let operation = format!( |
| 76 | "{color_action}{op}{color_reset}", | 79 | "{color_action}{op}{color_reset}", |
| 77 | color_action = Weechat::color(color_action), | 80 | color_action = color_action, |
| 78 | op = operation, | 81 | op = operation, |
| 79 | color_reset = Weechat::color("reset") | 82 | color_reset = color_reset |
| 80 | ); | 83 | ); |
| 81 | 84 | ||
| 82 | let target_name = format!( | 85 | let target_name = format!( |
| @@ -104,37 +107,47 @@ pub fn render_membership( | |||
| 104 | match (old_display_name != new_display_name, old_avatar != new_avatar) { | 107 | match (old_display_name != new_display_name, old_avatar != new_avatar) { |
| 105 | (false, true) => | 108 | (false, true) => |
| 106 | format!( | 109 | format!( |
| 107 | "{prefix} {target} changed their avatar", | 110 | "{prefix} {target} {color_action}changed their avatar{color_reset}", |
| 108 | prefix = Weechat::prefix(prefix), | 111 | prefix = Weechat::prefix(prefix), |
| 109 | target = target_name, | 112 | target = target_name, |
| 113 | color_action = color_action, | ||
| 114 | color_reset = color_reset | ||
| 110 | ), | 115 | ), |
| 111 | (true, false) => { | 116 | (true, false) => { |
| 112 | match new_display_name { | 117 | match new_display_name { |
| 113 | Some(name) => format!( | 118 | Some(name) => format!( |
| 114 | "{prefix} {target} changed their display name to {new}", | 119 | "{prefix} {target} {color_action}changed their display name to{color_reset} {new}", |
| 115 | prefix = Weechat::prefix(prefix), | 120 | prefix = Weechat::prefix(prefix), |
| 116 | target = target_name, | 121 | target = target_name, |
| 117 | new = name | 122 | new = name, |
| 123 | color_action = color_action, | ||
| 124 | color_reset = color_reset | ||
| 118 | ), | 125 | ), |
| 119 | std::option::Option::None => format!( | 126 | std::option::Option::None => format!( |
| 120 | "{prefix} {target} removed their display name", | 127 | "{prefix} {target} {color_action}removed their display name{color_reset}", |
| 121 | prefix = Weechat::prefix(prefix), | 128 | prefix = Weechat::prefix(prefix), |
| 122 | target = target_name, | 129 | target = target_name, |
| 130 | color_action = color_action, | ||
| 131 | color_reset = color_reset | ||
| 123 | ), | 132 | ), |
| 124 | } | 133 | } |
| 125 | } | 134 | } |
| 126 | (true, true) => | 135 | (true, true) => |
| 127 | match new_display_name { | 136 | match new_display_name { |
| 128 | Some(name) => format!( | 137 | Some(name) => format!( |
| 129 | "{prefix} {target} changed their avatar and changed their display name to {new}", | 138 | "{prefix} {target} {color_action}changed their avatar and changed their display name to{color_reset} {new}", |
| 130 | prefix = Weechat::prefix(prefix), | 139 | prefix = Weechat::prefix(prefix), |
| 131 | target = target_name, | 140 | target = target_name, |
| 132 | new = name | 141 | new = name, |
| 142 | color_action = color_action, | ||
| 143 | color_reset = color_reset | ||
| 133 | ), | 144 | ), |
| 134 | std::option::Option::None => format!( | 145 | std::option::Option::None => format!( |
| 135 | "{prefix} {target} changed their avatar and removed display name", | 146 | "{prefix} {target} {color_action}changed their avatar and removed display name{color_reset}", |
| 136 | prefix = Weechat::prefix(prefix), | 147 | prefix = Weechat::prefix(prefix), |
| 137 | target = target_name, | 148 | target = target_name, |
| 149 | color_action = color_action, | ||
| 150 | color_reset = color_reset | ||
| 138 | ), | 151 | ), |
| 139 | } | 152 | } |
| 140 | (false, false) => | 153 | (false, false) => |