Skip to content

Commit 85445c6

Browse files
update newer plugins to use styling struct
1 parent f944d62 commit 85445c6

File tree

5 files changed

+11
-24
lines changed

5 files changed

+11
-24
lines changed

default-plugins/configuration/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ struct State {
7171
ui_size: usize,
7272
current_screen: Screen,
7373
latest_mode_info: Option<ModeInfo>,
74-
colors: Palette,
74+
colors: Styling,
7575
}
7676

7777
impl Default for State {
@@ -82,7 +82,7 @@ impl Default for State {
8282
ui_size: UI_SIZE,
8383
current_screen: Screen::default(),
8484
latest_mode_info: None,
85-
colors: Palette::default(),
85+
colors: Palette::default().into(),
8686
}
8787
}
8888
}

default-plugins/configuration/src/ui_components.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
use crate::{Screen, WIDTH_BREAKPOINTS};
22
use zellij_tile::prelude::*;
33

4-
pub fn top_tab_menu(cols: usize, current_screen: &Screen, colors: &Palette) {
5-
let background = match colors.theme_hue {
6-
ThemeHue::Dark => colors.black,
7-
ThemeHue::Light => colors.white,
8-
};
4+
pub fn top_tab_menu(cols: usize, current_screen: &Screen, colors: &Styling) {
5+
let background = colors.text_unselected.background;
96
let bg_color = match background {
107
PaletteColor::Rgb((r, g, b)) => format!("\u{1b}[48;2;{};{};{}m\u{1b}[0K", r, g, b),
118
PaletteColor::EightBit(color) => format!("\u{1b}[48;5;{}m\u{1b}[0K", color),

default-plugins/plugin-manager/src/main.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub struct NewPluginScreen {
3434
selected_config_index: Option<usize>,
3535
request_ids: Vec<String>,
3636
load_in_background: bool,
37-
colors: Palette,
37+
colors: Styling,
3838
}
3939

4040
impl Default for NewPluginScreen {
@@ -50,13 +50,13 @@ impl Default for NewPluginScreen {
5050
selected_config_index: None,
5151
request_ids: vec![],
5252
load_in_background: true,
53-
colors: Palette::default(),
53+
colors: Palette::default().into(),
5454
}
5555
}
5656
}
5757

5858
impl NewPluginScreen {
59-
pub fn new(colors: Palette) -> Self {
59+
pub fn new(colors: Styling) -> Self {
6060
Self {
6161
colors,
6262
..Default::default()
@@ -261,10 +261,7 @@ impl NewPluginScreen {
261261
None,
262262
None,
263263
);
264-
let background = match self.colors.theme_hue {
265-
ThemeHue::Dark => self.colors.black,
266-
ThemeHue::Light => self.colors.white,
267-
};
264+
let background = self.colors.text_unselected.background;
268265
let bg_color = match background {
269266
PaletteColor::Rgb((r, g, b)) => format!("\u{1b}[48;2;{};{};{}m\u{1b}[0K", r, g, b),
270267
PaletteColor::EightBit(color) => format!("\u{1b}[48;5;{}m\u{1b}[0K", color),
@@ -496,7 +493,7 @@ struct State {
496493
plugin_id_to_tab_position: HashMap<u32, usize>,
497494
search_term: String,
498495
new_plugin_screen: Option<NewPluginScreen>,
499-
colors: Palette,
496+
colors: Styling,
500497
}
501498

502499
register_plugin!(State);

default-plugins/session-manager/src/main.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,7 @@ impl ZellijPlugin for State {
122122
fn render(&mut self, rows: usize, cols: usize) {
123123
let (x, y, width, height) = self.main_menu_size(rows, cols);
124124

125-
let background = match self.colors.palette.theme_hue {
126-
ThemeHue::Dark => self.colors.palette.black,
127-
ThemeHue::Light => self.colors.palette.white,
128-
};
125+
let background = self.colors.palette.text_unselected.background;
129126

130127
if self.is_welcome_screen {
131128
render_banner(x, 0, rows.saturating_sub(height), width);

default-plugins/status-bar/src/main.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,7 @@ impl ZellijPlugin for State {
262262
""
263263
};
264264

265-
let background = match self.mode_info.style.colors.theme_hue {
266-
ThemeHue::Dark => self.mode_info.style.colors.black,
267-
ThemeHue::Light => self.mode_info.style.colors.white,
268-
};
265+
let background = self.mode_info.style.colors.text_unselected.background;
269266

270267
if rows == 1 && !self.classic_ui {
271268
let fill_bg = match background {
@@ -294,7 +291,6 @@ impl ZellijPlugin for State {
294291
let first_line = first_line(&self.mode_info, active_tab, cols, separator);
295292
let second_line = self.second_line(cols);
296293

297-
let background = self.mode_info.style.colors.text_unselected.background;
298294
// [48;5;238m is white background, [0K is so that it fills the rest of the line
299295
// [m is background reset, [0K is so that it clears the rest of the line
300296
match background {

0 commit comments

Comments
 (0)