aboutsummaryrefslogtreecommitdiffstats
path: root/default-plugins/status-bar/src
diff options
context:
space:
mode:
authorDaniel Jankowski <Daniel.Jankowski@rub.de>2024-10-24 18:21:44 +0200
committerGitHub <noreply@github.com>2024-10-24 18:21:44 +0200
commit0cd6d5f4e5e7afcdd25cc45aaeeb80161498e322 (patch)
treef72011676c902a37828beee75f3d6e85a50124e4 /default-plugins/status-bar/src
parentdocs(changelog): suspend commands in remote layouts (diff)
downloadsl0ppij-0cd6d5f4e5e7afcdd25cc45aaeeb80161498e322.tar.gz
sl0ppij-0cd6d5f4e5e7afcdd25cc45aaeeb80161498e322.tar.xz
sl0ppij-0cd6d5f4e5e7afcdd25cc45aaeeb80161498e322.zip
feat(plugins): add configurable black background for ui components (#3681)
* feat(plugins): add transparent background for text and nested_list * chore: fix formatting issue * feat: invert flag behaviour * feat: implement bg_black handling for table cells * fix: order of selected and bg_black in protocol * chore: rename from bg_black to opaque * fix: explicit selected, if opaque and selected for text * chore: fix formatting issues * feat: opaque tab-bar * feat: opaque session-manager bars * feat: opaque ribbon in plugin manager * feat: opaque one-line ui * feat: opaque tab-bar in configuration plugin
Diffstat (limited to 'default-plugins/status-bar/src')
-rw-r--r--default-plugins/status-bar/src/main.rs19
-rw-r--r--default-plugins/status-bar/src/one_line_ui.rs13
2 files changed, 20 insertions, 12 deletions
diff --git a/default-plugins/status-bar/src/main.rs b/default-plugins/status-bar/src/main.rs
index 4fbc0089..8b35650c 100644
--- a/default-plugins/status-bar/src/main.rs
+++ b/default-plugins/status-bar/src/main.rs
@@ -253,10 +253,19 @@ impl ZellijPlugin for State {
""
};
+ 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,
+ };
+
if rows == 1 && !self.classic_ui {
+ let fill_bg = match background {
+ PaletteColor::Rgb((r, g, b)) => format!("\u{1b}[48;2;{};{};{}m\u{1b}[0K", r, g, b),
+ PaletteColor::EightBit(color) => format!("\u{1b}[48;5;{}m\u{1b}[0K", color),
+ };
let active_tab = self.tabs.iter().find(|t| t.active);
print!(
- "{}",
+ "{}{}",
one_line_ui(
&self.mode_info,
active_tab,
@@ -265,7 +274,8 @@ impl ZellijPlugin for State {
self.base_mode_is_locked,
self.text_copy_destination,
self.display_system_clipboard_failure,
- )
+ ),
+ fill_bg,
);
return;
}
@@ -274,11 +284,6 @@ impl ZellijPlugin for State {
let first_line = first_line(&self.mode_info, active_tab, cols, separator);
let second_line = self.second_line(cols);
- 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,
- };
-
// [48;5;238m is white background, [0K is so that it fills the rest of the line
// [m is background reset, [0K is so that it clears the rest of the line
match background {
diff --git a/default-plugins/status-bar/src/one_line_ui.rs b/default-plugins/status-bar/src/one_line_ui.rs
index 74184f57..777e97d2 100644
--- a/default-plugins/status-bar/src/one_line_ui.rs
+++ b/default-plugins/status-bar/src/one_line_ui.rs
@@ -650,7 +650,7 @@ fn render_common_modifiers(
line_part_to_render.part = format!(
"{}{}{}",
line_part_to_render.part,
- serialize_text(&Text::new(&prefix_text)),
+ serialize_text(&Text::new(&prefix_text).opaque()),
suffix_separator
);
line_part_to_render.len += prefix_text.chars().count() + separator.chars().count();
@@ -908,7 +908,7 @@ fn secondary_keybinds(help: &ModeInfo, tab_info: Option<&TabInfo>, max_len: usiz
}
fn text_as_line_part_with_emphasis(text: String, emphases_index: usize) -> LinePart {
- let part = serialize_text(&Text::new(&text).color_range(emphases_index, ..));
+ let part = serialize_text(&Text::new(&text).color_range(emphases_index, ..).opaque());
LinePart {
part,
len: text.width(),
@@ -1445,9 +1445,11 @@ fn style_key_with_modifier(keyvec: &[KeyWithModifier], color_index: Option<usize
if no_common_modifier || key.len() == 1 {
let key_string_text = format!(" {} ", key.join(key_separator));
let text = if let Some(color_index) = color_index {
- Text::new(&key_string_text).color_range(color_index, ..)
- } else {
Text::new(&key_string_text)
+ .color_range(color_index, ..)
+ .opaque()
+ } else {
+ Text::new(&key_string_text).opaque()
};
LinePart {
part: serialize_text(&text),
@@ -1464,8 +1466,9 @@ fn style_key_with_modifier(keyvec: &[KeyWithModifier], color_index: Option<usize
modifier_str.width() + 3
..modifier_str.width() + 3 + key_string_without_modifier.width(),
)
+ .opaque()
} else {
- Text::new(&key_string_text)
+ Text::new(&key_string_text).opaque()
};
LinePart {
part: serialize_text(&text),