diff options
| author | Daniel Jankowski <Daniel.Jankowski@rub.de> | 2024-10-24 18:21:44 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-24 18:21:44 +0200 |
| commit | 0cd6d5f4e5e7afcdd25cc45aaeeb80161498e322 (patch) | |
| tree | f72011676c902a37828beee75f3d6e85a50124e4 /default-plugins/configuration/src/ui_components.rs | |
| parent | docs(changelog): suspend commands in remote layouts (diff) | |
| download | sl0ppij-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/configuration/src/ui_components.rs')
| -rw-r--r-- | default-plugins/configuration/src/ui_components.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/default-plugins/configuration/src/ui_components.rs b/default-plugins/configuration/src/ui_components.rs index 3cbdf76c..d34488d4 100644 --- a/default-plugins/configuration/src/ui_components.rs +++ b/default-plugins/configuration/src/ui_components.rs @@ -1,7 +1,15 @@ use crate::{Screen, WIDTH_BREAKPOINTS}; use zellij_tile::prelude::*; -pub fn top_tab_menu(cols: usize, current_screen: &Screen) { +pub fn top_tab_menu(cols: usize, current_screen: &Screen, colors: &Palette) { + let background = match colors.theme_hue { + ThemeHue::Dark => colors.black, + ThemeHue::Light => colors.white, + }; + let bg_color = 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 first_ribbon_text_long = "Rebind leader keys"; let second_ribbon_text_long = "Change mode behavior"; let first_ribbon_text_short = "Rebind keys"; @@ -25,8 +33,9 @@ pub fn top_tab_menu(cols: usize, current_screen: &Screen) { if second_ribbon_is_selected { second_ribbon = second_ribbon.selected(); } - let switch_key = Text::new("<TAB>").color_range(3, ..); + let switch_key = Text::new("<TAB>").color_range(3, ..).opaque(); print_text_with_coordinates(switch_key, 0, 0, None, None); + print!("\u{1b}[{};{}H{}", 0, starting_positions.0 - 1, bg_color); print_ribbon_with_coordinates(first_ribbon, starting_positions.0, 0, None, None); print_ribbon_with_coordinates(second_ribbon, starting_positions.1, 0, None, None); } |
