diff options
author | Aram Drevekenin <aram@poor.dev> | 2022-06-06 11:30:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-06 11:30:40 +0200 |
commit | bded92f5537bc6d91b447d7c161b6d3f46cbd8bc (patch) | |
tree | bd27e848d75439996aefe3dbcc47b783b4a7a796 | |
parent | 56aa269a4b0c692a1e82aa24927a78763455598b (diff) |
feat(ui): minor tweaks to the compact tab bar (#1457)
* feat(ui): minor tweaks to the compact tab bar
* style(fmt): rustfmt
-rw-r--r-- | default-plugins/compact-bar/src/line.rs | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/default-plugins/compact-bar/src/line.rs b/default-plugins/compact-bar/src/line.rs index a181f5c78..71d3974e2 100644 --- a/default-plugins/compact-bar/src/line.rs +++ b/default-plugins/compact-bar/src/line.rs @@ -164,6 +164,11 @@ fn tab_line_prefix( ThemeHue::Dark => palette.black, ThemeHue::Light => palette.white, }; + + let locked_mode_color = palette.magenta; + let normal_mode_color = palette.green; + let other_modes_color = palette.orange; + let prefix_styled_text = style!(text_color, bg_color).bold().paint(prefix_text); let mut parts = vec![LinePart { part: prefix_styled_text.to_string(), @@ -184,12 +189,25 @@ fn tab_line_prefix( }) } } - let mode_part = format!("({:?})", mode); - let mode_part_len = mode_part.width(); - let mode_part_styled_text = style!(text_color, bg_color).bold().paint(mode_part); + let mode_part = format!("{:?}", mode).to_uppercase(); + let mode_part_padded = format!("{:^8}", mode_part); + let mode_part_len = mode_part_padded.width(); + let mode_part_styled_text = if mode == InputMode::Locked { + style!(locked_mode_color, bg_color) + .bold() + .paint(mode_part_padded) + } else if mode == InputMode::Normal { + style!(normal_mode_color, bg_color) + .bold() + .paint(mode_part_padded) + } else { + style!(other_modes_color, bg_color) + .bold() + .paint(mode_part_padded) + }; if cols.saturating_sub(prefix_text_len) >= mode_part_len { parts.push(LinePart { - part: format!(" {:^6} ", mode_part_styled_text), + part: format!("{} ", mode_part_styled_text), len: mode_part_len, }) } |