diff options
| author | Mark Grey <mark.asperia@gmail.com> | 2025-02-07 05:59:54 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-07 11:59:54 +0100 |
| commit | 26b99eac63869fb1209ecf39c4f9cdb21d0419ba (patch) | |
| tree | 4a12d05dc3eb55b651ea90888e56932b2fb3bd73 /default-plugins/status-bar | |
| parent | docs(issue-template): clarify requirements (diff) | |
| download | sl0ppij-26b99eac63869fb1209ecf39c4f9cdb21d0419ba.tar.gz sl0ppij-26b99eac63869fb1209ecf39c4f9cdb21d0419ba.tar.xz sl0ppij-26b99eac63869fb1209ecf39c4f9cdb21d0419ba.zip | |
feat(config): new theme definition spec (#3242)
* Implement initial structs from spec
* kdl configuration unmarshalling
* typo text styling
* remove is_selected toggle
* incorporate new status bar ui into theming
* improve test coverage of config behavior
* tab bar correction
* correct also compact bar
* remove spacing between table columns
* refactor table styling
* use text_unselected.emphasis_1 for keygroup sep
* fix tab bar more text
* repair field flattening for theme
* remove extra styling KDL node
* update tests
* updated selected text conversion
* padding for header bar
* minor corrections for existing themes
* background handling
* compact bar corrections
* properly handle opaque method to activate background
* update newer plugins to use styling struct
* correct omission of selected state
* fix: bold typeface for text elements
* fix: fg -> white for list_unselected conversion
* fix: emphasis and opacity handling for nested_list
* correct stylings in the session-manager
* fix emphases translation for table component
* correct emphasis for run instructions
* correct frame_highlight translation for old themes
* provide missing implementation of frame_highlight
* fencepost emphasis color names
* Set a pseudo-None for frame_unselected in old theme conversion
* correct alternating bg for simplified-ui
* update snapshots
* fix inner text padding and errorneous snapshots
* suppress warning about deprecated usage of palette
* remove unused import
* feat(plugins): API to change floating pane coordinates (#3958)
* basic functionality through the cli
* added to plugin api
* add display area and viewport size to TabInfo
* fix tests and add new one
* some cleanups
* refactor: extract pane_id parsing logic
* style(fmt): rustfmt
* docs(changelog): floating pane coordinate chagne API
* fix(tiled-panes): opening panes from the cli (#3963)
* feat(plugins): add `PastedText` Event (#3962)
* working with text paste
* handle utf8 conversion error
* feat(plugins): add PastedText Event
* docs(changelog): plugins pasted text event
* black for table opaque background
* properly apply opacity to table
* correct padding for explicit width ribbons
* feat(plugins): Allow opening panes near plugin (#3966)
* added command + terminal variants
* added editor variant
* style(fmt): rustfmt
* docs(changelog): plugin apis to open panes near plugin
* feat(plugins): send info about $EDITOR and $SHELL (#3971)
* feat(plugins): send info about $EDITOR and $SHELL
* fix(e2e): snapshot update
* docs(changelog): plugin editor and shell info
* fix(floating-panes): when changing coordinates, if a pane is not floating - make it floating (#3972)
* fix(panes): when changing floating pane coordinates, if the pane is not floating, float it
* style(fmt): rustfmt
* docs(changelog): floating pane coordinate fix
* fix(break-pane): strip logical position when inserting pane to new tab (#3973)
* docs(changelog): logical position fix
* Optional frame_unselected theme
* fixture with correct width to account for arrow padding
* update snapshot and rustfmt
---------
Co-authored-by: Aram Drevekenin <aram@poor.dev>
Diffstat (limited to 'default-plugins/status-bar')
10 files changed, 175 insertions, 197 deletions
diff --git a/default-plugins/status-bar/src/first_line.rs b/default-plugins/status-bar/src/first_line.rs index 9fd3b7d9..a67ef10b 100644 --- a/default-plugins/status-bar/src/first_line.rs +++ b/default-plugins/status-bar/src/first_line.rs @@ -344,14 +344,17 @@ fn key_indicators( line_part } -fn swap_layout_keycode(mode_info: &ModeInfo, palette: &Palette) -> LinePart { +fn swap_layout_keycode(mode_info: &ModeInfo) -> LinePart { let mode_keybinds = mode_info.get_mode_keybinds(); let prev_next_keys = action_key_group( &mode_keybinds, &[&[Action::PreviousSwapLayout], &[Action::NextSwapLayout]], ); - let prev_next_keys_indicator = - style_key_with_modifier(&prev_next_keys, palette, Some(palette.black)); + let prev_next_keys_indicator = style_key_with_modifier( + &prev_next_keys, + &mode_info.style.colors, + Some(mode_info.style.colors.text_unselected.background), + ); let keycode = ANSIStrings(&prev_next_keys_indicator); let len = unstyled_len(&keycode); let part = keycode.to_string(); @@ -364,14 +367,13 @@ fn swap_layout_status( is_swap_layout_damaged: bool, mode_info: &ModeInfo, colored_elements: ColoredElements, - palette: &Palette, separator: &str, ) -> Option<LinePart> { match swap_layout_name { Some(swap_layout_name) => { let mut swap_layout_name = format!(" {} ", swap_layout_name); swap_layout_name.make_ascii_uppercase(); - let keycode = swap_layout_keycode(mode_info, palette); + let keycode = swap_layout_keycode(mode_info); let swap_layout_name_len = swap_layout_name.len() + 3; // 2 for the arrow separators, one for the screen end buffer // macro_rules! style_swap_layout_indicator { @@ -701,7 +703,6 @@ pub fn first_line( tab_info.is_swap_layout_dirty, help, colored_elements, - &help.style.colors, separator, ) { remaining_space -= swap_layout_status.len; @@ -730,7 +731,7 @@ mod tests { use super::*; fn colored_elements() -> ColoredElements { - let palette = Palette::default(); + let palette = Styling::default(); color_elements(palette, false) } diff --git a/default-plugins/status-bar/src/main.rs b/default-plugins/status-bar/src/main.rs index 8b35650c..db2b7c6b 100644 --- a/default-plugins/status-bar/src/main.rs +++ b/default-plugins/status-bar/src/main.rs @@ -87,96 +87,105 @@ pub struct SegmentStyle { // we need different colors from palette for the default theme // plus here we can add new sources in the future, like Theme // that can be defined in the config perhaps -fn color_elements(palette: Palette, different_color_alternates: bool) -> ColoredElements { - let background = match palette.theme_hue { - ThemeHue::Dark => palette.black, - ThemeHue::Light => palette.white, - }; - let foreground = match palette.theme_hue { - ThemeHue::Dark => palette.white, - ThemeHue::Light => palette.black, - }; +fn color_elements(palette: Styling, different_color_alternates: bool) -> ColoredElements { + let background = palette.text_unselected.background; + let foreground = palette.text_unselected.base; let alternate_background_color = if different_color_alternates { - match palette.theme_hue { - ThemeHue::Dark => palette.white, - ThemeHue::Light => palette.black, - } + palette.ribbon_unselected.base } else { - palette.fg + palette.ribbon_unselected.background }; - match palette.source { - PaletteSource::Default => ColoredElements { - selected: SegmentStyle { - prefix_separator: style!(background, palette.green), - char_left_separator: style!(background, palette.green).bold(), - char_shortcut: style!(palette.red, palette.green).bold(), - char_right_separator: style!(background, palette.green).bold(), - styled_text: style!(background, palette.green).bold(), - suffix_separator: style!(palette.green, background).bold(), - }, - unselected: SegmentStyle { - prefix_separator: style!(background, palette.fg), - char_left_separator: style!(background, palette.fg).bold(), - char_shortcut: style!(palette.red, palette.fg).bold(), - char_right_separator: style!(background, palette.fg).bold(), - styled_text: style!(background, palette.fg).bold(), - suffix_separator: style!(palette.fg, background), - }, - unselected_alternate: SegmentStyle { - prefix_separator: style!(background, alternate_background_color), - char_left_separator: style!(background, alternate_background_color).bold(), - char_shortcut: style!(palette.red, alternate_background_color).bold(), - char_right_separator: style!(background, alternate_background_color).bold(), - styled_text: style!(background, alternate_background_color).bold(), - suffix_separator: style!(alternate_background_color, background), - }, - disabled: SegmentStyle { - prefix_separator: style!(background, palette.fg), - char_left_separator: style!(background, palette.fg).dimmed().italic(), - char_shortcut: style!(background, palette.fg).dimmed().italic(), - char_right_separator: style!(background, palette.fg).dimmed().italic(), - styled_text: style!(background, palette.fg).dimmed().italic(), - suffix_separator: style!(palette.fg, background), - }, - superkey_prefix: style!(foreground, background).bold(), - superkey_suffix_separator: style!(background, background), + ColoredElements { + selected: SegmentStyle { + prefix_separator: style!(background, palette.ribbon_selected.background), + char_left_separator: style!( + palette.ribbon_selected.base, + palette.ribbon_selected.background + ) + .bold(), + char_shortcut: style!( + palette.ribbon_selected.emphasis_0, + palette.ribbon_selected.background + ) + .bold(), + char_right_separator: style!( + palette.ribbon_selected.base, + palette.ribbon_selected.background + ) + .bold(), + styled_text: style!( + palette.ribbon_selected.base, + palette.ribbon_selected.background + ) + .bold(), + suffix_separator: style!(palette.ribbon_selected.background, background).bold(), }, - PaletteSource::Xresources => ColoredElements { - selected: SegmentStyle { - prefix_separator: style!(background, palette.green), - char_left_separator: style!(palette.fg, palette.green).bold(), - char_shortcut: style!(palette.red, palette.green).bold(), - char_right_separator: style!(palette.fg, palette.green).bold(), - styled_text: style!(background, palette.green).bold(), - suffix_separator: style!(palette.green, background).bold(), - }, - unselected: SegmentStyle { - prefix_separator: style!(background, palette.fg), - char_left_separator: style!(background, palette.fg).bold(), - char_shortcut: style!(palette.red, palette.fg).bold(), - char_right_separator: style!(background, palette.fg).bold(), - styled_text: style!(background, palette.fg).bold(), - suffix_separator: style!(palette.fg, background), - }, - unselected_alternate: SegmentStyle { - prefix_separator: style!(background, alternate_background_color), - char_left_separator: style!(background, alternate_background_color).bold(), - char_shortcut: style!(palette.red, alternate_background_color).bold(), - char_right_separator: style!(background, alternate_background_color).bold(), - styled_text: style!(background, alternate_background_color).bold(), - suffix_separator: style!(alternate_background_color, background), - }, - disabled: SegmentStyle { - prefix_separator: style!(background, palette.fg), - char_left_separator: style!(background, palette.fg).dimmed(), - char_shortcut: style!(background, palette.fg).dimmed(), - char_right_separator: style!(background, palette.fg).dimmed(), - styled_text: style!(background, palette.fg).dimmed(), - suffix_separator: style!(palette.fg, background), - }, - superkey_prefix: style!(background, palette.fg).bold(), - superkey_suffix_separator: style!(palette.fg, background), + unselected: SegmentStyle { + prefix_separator: style!(background, palette.ribbon_unselected.background), + char_left_separator: style!( + palette.ribbon_unselected.base, + palette.ribbon_unselected.background + ) + .bold(), + char_shortcut: style!( + palette.ribbon_unselected.emphasis_0, + palette.ribbon_unselected.background + ) + .bold(), + char_right_separator: style!( + palette.ribbon_unselected.base, + palette.ribbon_unselected.background + ) + .bold(), + styled_text: style!( + palette.ribbon_unselected.base, + palette.ribbon_unselected.background + ) + .bold(), + suffix_separator: style!(palette.ribbon_unselected.background, background).bold(), }, + unselected_alternate: SegmentStyle { + prefix_separator: style!(background, alternate_background_color), + char_left_separator: style!(background, alternate_background_color).bold(), + char_shortcut: style!( + palette.ribbon_unselected.emphasis_0, + alternate_background_color + ) + .bold(), + char_right_separator: style!(background, alternate_background_color).bold(), + styled_text: style!(palette.ribbon_unselected.base, alternate_background_color).bold(), + suffix_separator: style!(alternate_background_color, background).bold(), + }, + disabled: SegmentStyle { + prefix_separator: style!(background, palette.ribbon_unselected.background), + char_left_separator: style!( + palette.ribbon_unselected.base, + palette.ribbon_unselected.background + ) + .dimmed() + .italic(), + char_shortcut: style!( + palette.ribbon_unselected.base, + palette.ribbon_unselected.background + ) + .dimmed() + .italic(), + char_right_separator: style!( + palette.ribbon_unselected.base, + palette.ribbon_unselected.background + ) + .dimmed() + .italic(), + styled_text: style!( + palette.ribbon_unselected.base, + palette.ribbon_unselected.background + ) + .dimmed() + .italic(), + suffix_separator: style!(palette.ribbon_unselected.background, background), + }, + superkey_prefix: style!(foreground, background).bold(), + superkey_suffix_separator: style!(background, background), } } @@ -253,10 +262,7 @@ 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, - }; + let background = self.mode_info.style.colors.text_unselected.background; if rows == 1 && !self.classic_ui { let fill_bg = match background { @@ -280,6 +286,7 @@ impl ZellijPlugin for State { return; } + //TODO: Switch to UI components here let active_tab = self.tabs.iter().find(|t| t.active); let first_line = first_line(&self.mode_info, active_tab, cols, separator); let second_line = self.second_line(cols); @@ -432,19 +439,16 @@ pub fn action_key_group( /// type. pub fn style_key_with_modifier( keyvec: &[KeyWithModifier], - palette: &Palette, + palette: &Styling, background: Option<PaletteColor>, ) -> Vec<ANSIString<'static>> { if keyvec.is_empty() { return vec![]; } - let text_color = palette_match!(match palette.theme_hue { - ThemeHue::Dark => palette.white, - ThemeHue::Light => palette.black, - }); - let green_color = palette_match!(palette.green); - let orange_color = palette_match!(palette.orange); + let text_color = palette_match!(palette.text_unselected.base); + let green_color = palette_match!(palette.text_unselected.emphasis_2); + let orange_color = palette_match!(palette.text_unselected.emphasis_0); let mut ret = vec![]; let common_modifiers = get_common_modifiers(keyvec.iter().collect()); @@ -706,7 +710,7 @@ pub mod tests { KeyWithModifier::new(BareKey::Char('b')), KeyWithModifier::new(BareKey::Char('c')), ]; - let palette = get_palette(); + let palette = Styling::default(); let ret = style_key_with_modifier(&keyvec, &palette, None); let ret = unstyle(&ANSIStrings(&ret)); @@ -722,7 +726,7 @@ pub mod tests { KeyWithModifier::new(BareKey::Char('k')), KeyWithModifier::new(BareKey::Char('l')), ]; - let palette = get_palette(); + let palette = Styling::default(); let ret = style_key_with_modifier(&keyvec, &palette, None); let ret = unstyle(&ANSIStrings(&ret)); @@ -738,7 +742,7 @@ pub mod tests { KeyWithModifier::new(BareKey::Up), KeyWithModifier::new(BareKey::Right), ]; - let palette = get_palette(); + let palette = Styling::default(); let ret = style_key_with_modifier(&keyvec, &palette, None); let ret = unstyle(&ANSIStrings(&ret)); @@ -752,7 +756,7 @@ pub mod tests { KeyWithModifier::new(BareKey::Left), KeyWithModifier::new(BareKey::Right), ]; - let palette = get_palette(); + let palette = Styling::default(); let ret = style_key_with_modifier(&keyvec, &palette, None); let ret = unstyle(&ANSIStrings(&ret)); @@ -766,7 +770,7 @@ pub mod tests { KeyWithModifier::new(BareKey::Down), KeyWithModifier::new(BareKey::Up), ]; - let palette = get_palette(); + let palette = Styling::default(); let ret = style_key_with_modifier(&keyvec, &palette, None); let ret = unstyle(&ANSIStrings(&ret)); @@ -782,7 +786,7 @@ pub mod tests { KeyWithModifier::new(BareKey::Char('c')).with_ctrl_modifier(), KeyWithModifier::new(BareKey::Char('d')).with_ctrl_modifier(), ]; - let palette = get_palette(); + let palette = Styling::default(); let ret = style_key_with_modifier(&keyvec, &palette, None); let ret = unstyle(&ANSIStrings(&ret)); @@ -798,7 +802,7 @@ pub mod tests { KeyWithModifier::new(BareKey::Char('c')).with_alt_modifier(), KeyWithModifier::new(BareKey::Char('d')).with_alt_modifier(), ]; - let palette = get_palette(); + let palette = Styling::default(); let ret = style_key_with_modifier(&keyvec, &palette, None); let ret = unstyle(&ANSIStrings(&ret)); @@ -814,7 +818,7 @@ pub mod tests { KeyWithModifier::new(BareKey::Up).with_alt_modifier(), KeyWithModifier::new(BareKey::Right).with_alt_modifier(), ]; - let palette = get_palette(); + let palette = Styling::default(); let ret = style_key_with_modifier(&keyvec, &palette, None); let ret = unstyle(&ANSIStrings(&ret)); @@ -829,7 +833,7 @@ pub mod tests { KeyWithModifier::new(BareKey::Char('b')).with_ctrl_modifier(), KeyWithModifier::new(BareKey::Char('c')), ]; - let palette = get_palette(); + let palette = Styling::default(); let ret = style_key_with_modifier(&keyvec, &palette, None); let ret = unstyle(&ANSIStrings(&ret)); @@ -852,7 +856,7 @@ pub mod tests { KeyWithModifier::new(BareKey::Tab), KeyWithModifier::new(BareKey::Esc), ]; - let palette = get_palette(); + let palette = Styling::default(); let ret = style_key_with_modifier(&keyvec, &palette, None); let ret = unstyle(&ANSIStrings(&ret)); @@ -870,7 +874,7 @@ pub mod tests { KeyWithModifier::new(BareKey::Char(' ')).with_ctrl_modifier(), KeyWithModifier::new(BareKey::Tab).with_ctrl_modifier(), ]; - let palette = get_palette(); + let palette = Styling::default(); let ret = style_key_with_modifier(&keyvec, &palette, None); let ret = unstyle(&ANSIStrings(&ret)); @@ -885,7 +889,7 @@ pub mod tests { KeyWithModifier::new(BareKey::Char(' ')).with_alt_modifier(), KeyWithModifier::new(BareKey::Tab).with_alt_modifier(), ]; - let palette = get_palette(); + let palette = Styling::default(); let ret = style_key_with_modifier(&keyvec, &palette, None); let ret = unstyle(&ANSIStrings(&ret)); diff --git a/default-plugins/status-bar/src/one_line_ui.rs b/default-plugins/status-bar/src/one_line_ui.rs index 777e97d2..4d47281e 100644 --- a/default-plugins/status-bar/src/one_line_ui.rs +++ b/default-plugins/status-bar/src/one_line_ui.rs @@ -1064,8 +1064,8 @@ fn add_keygroup_separator(help: &ModeInfo, max_len: usize) -> Option<LinePart> { let mut ret = LinePart::default(); - let separator_color = palette_match!(palette.orange); - let bg_color = palette_match!(palette.black); + let separator_color = palette_match!(palette.text_unselected.emphasis_0); + let bg_color = palette_match!(palette.ribbon_selected.base); let mut bits: Vec<ANSIString> = vec![]; let mode_help_text = match help.mode { InputMode::RenamePane => Some("RENAMING PANE"), diff --git a/default-plugins/status-bar/src/second_line.rs b/default-plugins/status-bar/src/second_line.rs index fa2be639..0c13ad14 100644 --- a/default-plugins/status-bar/src/second_line.rs +++ b/default-plugins/status-bar/src/second_line.rs @@ -17,16 +17,13 @@ fn full_length_shortcut( is_first_shortcut: bool, key: Vec<KeyWithModifier>, action: &str, - palette: Palette, + palette: Styling, ) -> LinePart { if key.is_empty() { return LinePart::default(); } - let text_color = palette_match!(match palette.theme_hue { - ThemeHue::Dark => palette.white, - ThemeHue::Light => palette.black, - }); + let text_color = palette_match!(palette.text_unselected.base); let separator = if is_first_shortcut { " " } else { " / " }; let mut bits: Vec<ANSIString> = vec![Style::new().fg(text_color).paint(separator)]; @@ -45,13 +42,10 @@ fn full_length_shortcut( } } -fn locked_interface_indication(palette: Palette) -> LinePart { +fn locked_interface_indication(palette: Styling) -> LinePart { let locked_text = " -- INTERFACE LOCKED -- "; let locked_text_len = locked_text.chars().count(); - let text_color = palette_match!(match palette.theme_hue { - ThemeHue::Dark => palette.white, - ThemeHue::Light => palette.black, - }); + let text_color = palette_match!(palette.text_unselected.base); let locked_styled_text = Style::new().fg(text_color).bold().paint(locked_text); LinePart { part: locked_styled_text.to_string(), @@ -354,8 +348,8 @@ pub fn keybinds(help: &ModeInfo, tip_name: &str, max_width: usize) -> LinePart { best_effort_shortcut_list(help, tip_body.short, max_width) } -pub fn text_copied_hint(palette: &Palette, copy_destination: CopyDestination) -> LinePart { - let green_color = palette_match!(palette.green); +pub fn text_copied_hint(palette: &Styling, copy_destination: CopyDestination) -> LinePart { + let green_color = palette_match!(palette.text_unselected.emphasis_2); let hint = match copy_destination { CopyDestination::Command => "Text piped to external command", #[cfg(not(target_os = "macos"))] @@ -370,22 +364,19 @@ pub fn text_copied_hint(palette: &Palette, copy_destination: CopyDestination) -> } } -pub fn system_clipboard_error(palette: &Palette) -> LinePart { +pub fn system_clipboard_error(palette: &Styling) -> LinePart { let hint = " Error using the system clipboard."; - let red_color = palette_match!(palette.red); + let red_color = palette_match!(palette.text_unselected.emphasis_3); LinePart { part: Style::new().fg(red_color).bold().paint(hint).to_string(), len: hint.len(), } } -pub fn fullscreen_panes_to_hide(palette: &Palette, panes_to_hide: usize) -> LinePart { - let text_color = palette_match!(match palette.theme_hue { - ThemeHue::Dark => palette.white, - ThemeHue::Light => palette.black, - }); - let green_color = palette_match!(palette.green); - let orange_color = palette_match!(palette.orange); +pub fn fullscreen_panes_to_hide(palette: &Styling, panes_to_hide: usize) -> LinePart { + let text_color = palette_match!(palette.text_unselected.base); + let green_color = palette_match!(palette.text_unselected.emphasis_2); + let orange_color = palette_match!(palette.text_unselected.emphasis_0); let shortcut_left_separator = Style::new().fg(text_color).bold().paint(" ("); let shortcut_right_separator = Style::new().fg(text_color).bold().paint("): "); let fullscreen = "FULLSCREEN"; @@ -414,18 +405,9 @@ pub fn fullscreen_panes_to_hide(palette: &Palette, panes_to_hide: usize) -> Line pub fn floating_panes_are_visible(mode_info: &ModeInfo) -> LinePart { let palette = mode_info.style.colors; let km = &mode_info.get_mode_keybinds(); - let white_color = match palette.white { - PaletteColor::Rgb((r, g, b)) => RGB(r, g, b), - PaletteColor::EightBit(color) => Fixed(color), - }; - let green_color = match palette.green { - PaletteColor::Rgb((r, g, b)) => RGB(r, g, b), - PaletteColor::EightBit(color) => Fixed(color), - }; - let orange_color = match palette.orange { - PaletteColor::Rgb((r, g, b)) => RGB(r, g, b), - PaletteColor::EightBit(color) => Fixed(color), - }; + let white_color = palette_match!(palette.text_unselected.base); + let green_color = palette_match!(palette.text_unselected.emphasis_2); + let orange_color = palette_match!(palette.text_unselected.emphasis_0); let shortcut_left_separator = Style::new().fg(white_color).bold().paint(" ("); let shortcut_right_separator = Style::new().fg(white_color).bold().paint("): "); let floating_panes = "FLOATING PANES VISIBLE"; @@ -477,13 +459,10 @@ pub fn floating_panes_are_visible(mode_info: &ModeInfo) -> LinePart { } } -pub fn locked_fullscreen_panes_to_hide(palette: &Palette, panes_to_hide: usize) -> LinePart { - let text_color = palette_match!(match palette.theme_hue { - ThemeHue::Dark => palette.white, - ThemeHue::Light => palette.black, - }); - let green_color = palette_match!(palette.green); - let orange_color = palette_match!(palette.orange); +pub fn locked_fullscreen_panes_to_hide(palette: &Styling, panes_to_hide: usize) -> LinePart { + let text_color = palette_match!(palette.text_unselected.base); + let green_color = palette_match!(palette.text_unselected.emphasis_2); + let orange_color = palette_match!(palette.text_unselected.emphasis_0); let locked_text = " -- INTERFACE LOCKED -- "; let shortcut_left_separator = Style::new().fg(text_color).bold().paint(" ("); let shortcut_right_separator = Style::new().fg(text_color).bold().paint("): "); @@ -512,15 +491,9 @@ pub fn locked_fullscreen_panes_to_hide(palette: &Palette, panes_to_hide: usize) } } -pub fn locked_floating_panes_are_visible(palette: &Palette) -> LinePart { - let white_color = match palette.white { - PaletteColor::Rgb((r, g, b)) => RGB(r, g, b), - PaletteColor::EightBit(color) => Fixed(color), - }; - let orange_color = match palette.orange { - PaletteColor::Rgb((r, g, b)) => RGB(r, g, b), - PaletteColor::EightBit(color) => Fixed(color), - }; +pub fn locked_floating_panes_are_visible(palette: &Styling) -> LinePart { + let white_color = palette_match!(palette.text_unselected.base); + let orange_color = palette_match!(palette.text_unselected.emphasis_0); let shortcut_left_separator = Style::new().fg(white_color).bold().paint(" ("); let shortcut_right_separator = Style::new().fg(white_color).bold().paint(")"); let locked_text = " -- INTERFACE LOCKED -- "; @@ -566,7 +539,7 @@ mod tests { #[test] fn full_length_shortcut_with_key() { let keyvec = vec![KeyWithModifier::new(BareKey::Char('a'))]; - let palette = get_palette(); + let palette = Styling::default(); let ret = full_length_shortcut(false, keyvec, "Foobar", palette); let ret = unstyle(ret); @@ -577,7 +550,7 @@ mod tests { #[test] fn full_length_shortcut_with_key_first_element() { let keyvec = vec![KeyWithModifier::new(BareKey::Char('a'))]; - let palette = get_palette(); + let palette = Styling::default(); let ret = full_length_shortcut(true, keyvec, "Foobar", palette); let ret = unstyle(ret); @@ -589,7 +562,7 @@ mod tests { // When there is no binding, we print no shortcut either fn full_length_shortcut_without_key() { let keyvec = vec![]; - let palette = get_palette(); + let palette = Styling::default(); let ret = full_length_shortcut(false, keyvec, "Foobar", palette); let ret = unstyle(ret); @@ -600,7 +573,7 @@ mod tests { #[test] fn full_length_shortcut_with_key_unprintable_1() { let keyvec = vec![KeyWithModifier::new(BareKey::Enter)]; - let palette = get_palette(); + let palette = Styling::default(); let ret = full_length_shortcut(false, keyvec, "Foobar", palette); let ret = unstyle(ret); @@ -611,7 +584,7 @@ mod tests { #[test] fn full_length_shortcut_with_key_unprintable_2() { let keyvec = vec![KeyWithModifier::new(BareKey::Backspace)]; - let palette = get_palette(); + let palette = Styling::default(); let ret = full_length_shortcut(false, keyvec, "Foobar", palette); let ret = unstyle(ret); @@ -622,7 +595,7 @@ mod tests { #[test] fn full_length_shortcut_with_ctrl_key() { let keyvec = vec![KeyWithModifier::new(BareKey::Char('a')).with_ctrl_modifier()]; - let palette = get_palette(); + let palette = Styling::default(); let ret = full_length_shortcut(false, keyvec, "Foobar", palette); let ret = unstyle(ret); @@ -633,7 +606,7 @@ mod tests { #[test] fn full_length_shortcut_with_alt_key() { let keyvec = vec![KeyWithModifier::new(BareKey::Char('a')).with_alt_modifier()]; - let palette = get_palette(); + let palette = Styling::default(); let ret = full_length_shortcut(false, keyvec, "Foobar", palette); let ret = unstyle(ret); @@ -648,7 +621,7 @@ mod tests { KeyWithModifier::new(BareKey::Char('b')), KeyWithModifier::new(BareKey::Char('c')), ]; - let palette = get_palette(); + let palette = Styling::default(); let ret = full_length_shortcut(false, keyvec, "Foobar", palette); let ret = unstyle(ret); @@ -663,7 +636,7 @@ mod tests { KeyWithModifier::new(BareKey::Char('b')).with_ctrl_modifier(), KeyWithModifier::new(BareKey::Enter), ]; - let palette = get_palette(); + let palette = Styling::default(); let ret = full_length_shortcut(false, keyvec, "Foobar", palette); let ret = unstyle(ret); @@ -678,7 +651,7 @@ mod tests { KeyWithModifier::new(BareKey::Char('b')).with_ctrl_modifier(), KeyWithModifier::new(BareKey::Char('c')).with_ctrl_modifier(), ]; - let palette = get_palette(); + let palette = Styling::default(); let ret = full_length_shortcut(false, keyvec, "Foobar", palette); let ret = unstyle(ret); diff --git a/default-plugins/status-bar/src/tip/data/compact_layout.rs b/default-plugins/status-bar/src/tip/data/compact_layout.rs index 77dec8a6..6da1a155 100644 --- a/default-plugins/status-bar/src/tip/data/compact_layout.rs +++ b/default-plugins/status-bar/src/tip/data/compact_layout.rs @@ -25,7 +25,7 @@ macro_rules! strings { pub fn compact_layout_full(help: &ModeInfo) -> LinePart { // Tip: UI taking up too much space? Start Zellij with // zellij -l compact or remove pane frames with Ctrl + <p> + <z> - let green_color = palette_match!(help.style.colors.green); + let green_color = palette_match!(help.style.colors.text_unselected.emphasis_0); let mut bits = vec