diff options
Diffstat (limited to 'default-plugins/tab-bar')
-rw-r--r-- | default-plugins/tab-bar/src/line.rs | 42 | ||||
-rw-r--r-- | default-plugins/tab-bar/src/main.rs | 6 | ||||
-rw-r--r-- | default-plugins/tab-bar/src/tab.rs | 14 |
3 files changed, 42 insertions, 20 deletions
diff --git a/default-plugins/tab-bar/src/line.rs b/default-plugins/tab-bar/src/line.rs index b8c58854d..51af1474b 100644 --- a/default-plugins/tab-bar/src/line.rs +++ b/default-plugins/tab-bar/src/line.rs @@ -102,11 +102,13 @@ fn left_more_message(tab_count_to_the_left: usize, palette: Palette, separator: // 238 // chars length plus separator length on both sides let more_text_len = more_text.width() + 2 * separator.width(); - let left_separator = style!(palette.gray, palette.orange).paint(separator); - let more_styled_text = style!(palette.black, palette.orange) - .bold() - .paint(more_text); - let right_separator = style!(palette.orange, palette.gray).paint(separator); + let text_color = match palette.theme_hue { + ThemeHue::Dark => palette.white, + ThemeHue::Light => palette.black, + }; + let left_separator = style!(text_color, palette.orange).paint(separator); + let more_styled_text = style!(text_color, palette.orange).bold().paint(more_text); + let right_separator = style!(palette.orange, text_color).paint(separator); let more_styled_text = ANSIStrings(&[left_separator, more_styled_text, right_separator]).to_string(); LinePart { @@ -130,11 +132,13 @@ fn right_more_message( }; // chars length plus separator length on both sides let more_text_len = more_text.width() + 2 * separator.width(); - let left_separator = style!(palette.gray, palette.orange).paint(separator); - let more_styled_text = style!(palette.black, palette.orange) - .bold() - .paint(more_text); - let right_separator = style!(palette.orange, palette.gray).paint(separator); + let text_color = match palette.theme_hue { + ThemeHue::Dark => palette.white, + ThemeHue::Light => palette.black, + }; + let left_separator = style!(text_color, palette.orange).paint(separator); + let more_styled_text = style!(text_color, palette.orange).bold().paint(more_text); + let right_separator = style!(palette.orange, text_color).paint(separator); let more_styled_text = ANSIStrings(&[left_separator, more_styled_text, right_separator]).to_string(); LinePart { @@ -147,9 +151,15 @@ fn tab_line_prefix(session_name: Option<&str>, palette: Palette, cols: usize) -> let prefix_text = " Zellij ".to_string(); let prefix_text_len = prefix_text.chars().count(); - let prefix_styled_text = style!(palette.white, palette.gray) - .bold() - .paint(prefix_text); + let text_color = match palette.theme_hue { + ThemeHue::Dark => palette.white, + ThemeHue::Light => palette.black, + }; + let bg_color = match palette.theme_hue { + ThemeHue::Dark => palette.black, + ThemeHue::Light => palette.white, + }; + let prefix_styled_text = style!(text_color, bg_color).bold().paint(prefix_text); let mut parts = vec![LinePart { part: prefix_styled_text.to_string(), len: prefix_text_len, @@ -157,7 +167,11 @@ fn tab_line_prefix(session_name: Option<&str>, palette: Palette, cols: usize) -> if let Some(name) = session_name { let name_part = format!("({}) ", name); let name_part_len = name_part.width(); - let name_part_styled_text = style!(palette.white, palette.gray).bold().paint(name_part); + let text_color = match palette.theme_hue { + ThemeHue::Dark => palette.white, + ThemeHue::Light => palette.black, + }; + let name_part_styled_text = style!(text_color, bg_color).bold().paint(name_part); if cols.saturating_sub(prefix_text_len) >= name_part_len { parts.push(LinePart { part: name_part_styled_text.to_string(), diff --git a/default-plugins/tab-bar/src/main.rs b/default-plugins/tab-bar/src/main.rs index 2067af9d2..726a77d16 100644 --- a/default-plugins/tab-bar/src/main.rs +++ b/default-plugins/tab-bar/src/main.rs @@ -119,7 +119,11 @@ impl ZellijPlugin for State { } len_cnt += bar_part.len; } - match self.mode_info.style.colors.gray { + let background = match self.mode_info.style.colors.theme_hue { + ThemeHue::Dark => self.mode_info.style.colors.black, + ThemeHue::Light => self.mode_info.style.colors.white, + }; + match background { PaletteColor::Rgb((r, g, b)) => { println!("{}\u{1b}[48;2;{};{};{}m\u{1b}[0K", s, r, g, b); } diff --git a/default-plugins/tab-bar/src/tab.rs b/default-plugins/tab-bar/src/tab.rs index 4ed3b2076..993489620 100644 --- a/default-plugins/tab-bar/src/tab.rs +++ b/default-plugins/tab-bar/src/tab.rs @@ -25,24 +25,28 @@ pub fn render_tab( active: bool, ) -> LinePart { let background_color = if active { palette.green } else { palette.fg }; - let left_separator = style!(palette.gray, background_color).paint(separator); + let foreground_color = match palette.theme_hue { + ThemeHue::Dark => palette.black, + ThemeHue::Light => palette.white, + }; + let left_separator = style!(foreground_color, background_color).paint(separator); let mut tab_text_len = text.width() + 2 + separator.width() * 2; // 2 for left and right separators, 2 for the text padding - let tab_styled_text = style!(palette.black, background_color) + let tab_styled_text = style!(foreground_color, background_color) .bold() .paint(format!(" {} ", text)); - let right_separator = style!(background_color, palette.gray).paint(separator); + let right_separator = style!(background_color, foreground_color).paint(separator); let tab_styled_text = if !focused_clients.is_empty() { let (cursor_section, extra_length) = cursors(focused_clients, palette); tab_text_len += extra_length; let mut s = String::new(); - let cursor_beginning = style!(palette.black, background_color) + let cursor_beginning = style!(foreground_color, background_color) .bold() .paint("[") .to_string(); let cursor_section = ANSIStrings(&cursor_section).to_string(); - let cursor_end = style!(palette.black, background_color) + let cursor_end = style!(foreground_color, background_color) .bold() .paint("]") .to_string(); |