aboutsummaryrefslogtreecommitdiffstats
path: root/default-plugins
diff options
context:
space:
mode:
authorMark Grey <mark.asperia@gmail.com>2025-02-07 05:59:54 -0500
committerGitHub <noreply@github.com>2025-02-07 11:59:54 +0100
commit26b99eac63869fb1209ecf39c4f9cdb21d0419ba (patch)
tree4a12d05dc3eb55b651ea90888e56932b2fb3bd73 /default-plugins
parentdocs(issue-template): clarify requirements (diff)
downloadsl0ppij-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')
-rw-r--r--default-plugins/compact-bar/src/line.rs94
-rw-r--r--default-plugins/compact-bar/src/main.rs5
-rw-r--r--default-plugins/compact-bar/src/tab.rs35
-rw-r--r--default-plugins/configuration/src/main.rs4
-rw-r--r--default-plugins/configuration/src/ui_components.rs7
-rw-r--r--default-plugins/plugin-manager/src/main.rs13
-rw-r--r--default-plugins/session-manager/src/main.rs5
-rw-r--r--default-plugins/session-manager/src/ui/components.rs177
-rw-r--r--default-plugins/status-bar/src/first_line.rs15
-rw-r--r--default-plugins/status-bar/src/main.rs220
-rw-r--r--default-plugins/status-bar/src/one_line_ui.rs4
-rw-r--r--default-plugins/status-bar/src/second_line.rs91
-rw-r--r--default-plugins/status-bar/src/tip/data/compact_layout.rs6
-rw-r--r--default-plugins/status-bar/src/tip/data/edit_scrollbuffer.rs6
-rw-r--r--default-plugins/status-bar/src/tip/data/move_tabs.rs6
-rw-r--r--default-plugins/status-bar/src/tip/data/send_mouse_click_to_terminal.rs12
-rw-r--r--default-plugins/status-bar/src/tip/data/use_mouse.rs6
-rw-r--r--default-plugins/status-bar/src/tip/data/zellij_setup_check.rs6
-rw-r--r--default-plugins/tab-bar/src/line.rs66
-rw-r--r--default-plugins/tab-bar/src/main.rs5
-rw-r--r--default-plugins/tab-bar/src/tab.rs40
21 files changed, 413 insertions, 410 deletions
diff --git a/default-plugins/compact-bar/src/line.rs b/default-plugins/compact-bar/src/line.rs
index fa5fd3e9..5d50d527 100644
--- a/default-plugins/compact-bar/src/line.rs
+++ b/default-plugins/compact-bar/src/line.rs
@@ -16,7 +16,7 @@ fn populate_tabs_in_tab_line(
tabs_after_active: &mut Vec<LinePart>,
tabs_to_render: &mut Vec<LinePart>,
cols: usize,
- palette: Palette,
+ palette: Styling,
capabilities: PluginCapabilities,
) {
let mut middle_size = get_current_title_len(tabs_to_render);
@@ -107,7 +107,7 @@ fn populate_tabs_in_tab_line(
fn left_more_message(
tab_count_to_the_left: usize,
- palette: Palette,
+ palette: Styling,
separator: &str,
tab_index: usize,
) -> LinePart {
@@ -122,13 +122,14 @@ fn left_more_message(
// 238
// chars length plus separator length on both sides
let more_text_len = more_text.width() + 2 * separator.width();
- let (text_color, sep_color) = match palette.theme_hue {
- ThemeHue::Dark => (palette.white, palette.black),
- ThemeHue::Light => (palette.black, palette.white),
- };
- let left_separator = style!(sep_color, palette.orange).paint(separator);
- let more_styled_text = style!(text_color, palette.orange).bold().paint(more_text);
- let right_separator = style!(palette.orange, sep_color).paint(separator);
+ let (text_color, sep_color) = (
+ palette.ribbon_unselected.base,
+ palette.text_unselected.background,
+ );
+ let plus_ribbon_bg = palette.text_selected.emphasis_0;
+ let left_separator = style!(sep_color, plus_ribbon_bg).paint(separator);
+ let more_styled_text = style!(text_color, plus_ribbon_bg).bold().paint(more_text);
+ let right_separator = style!(plus_ribbon_bg, sep_color).paint(separator);
let more_styled_text =
ANSIStrings(&[left_separator, more_styled_text, right_separator]).to_string();
LinePart {
@@ -140,7 +141,7 @@ fn left_more_message(
fn right_more_message(
tab_count_to_the_right: usize,
- palette: Palette,
+ palette: Styling,
separator: &str,
tab_index: usize,
) -> LinePart {
@@ -154,13 +155,15 @@ fn right_more_message(
};
// chars length plus separator length on both sides
let more_text_len = more_text.width() + 2 * separator.width();
- let (text_color, sep_color) = match palette.theme_hue {
- ThemeHue::Dark => (palette.white, palette.black),
- ThemeHue::Light => (palette.black, palette.white),
- };
- let left_separator = style!(sep_color, palette.orange).paint(separator);
- let more_styled_text = style!(text_color, palette.orange).bold().paint(more_text);
- let right_separator = style!(palette.orange, sep_color).paint(separator);
+
+ let (text_color, sep_color) = (
+ palette.ribbon_unselected.base,
+ palette.text_unselected.background,
+ );
+ let plus_ribbon_bg = palette.text_selected.emphasis_0;
+ let left_separator = style!(sep_color, plus_ribbon_bg).paint(separator);
+ let more_styled_text = style!(text_color, plus_ribbon_bg).bold().paint(more_text);
+ let right_separator = style!(plus_ribbon_bg, sep_color).paint(separator);
let more_styled_text =
ANSIStrings(&[left_separator, more_styled_text, right_separator]).to_string();
LinePart {
@@ -173,24 +176,17 @@ fn right_more_message(
fn tab_line_prefix(
session_name: Option<&str>,
mode: InputMode,
- palette: Palette,
+ palette: Styling,
cols: usize,
) -> Vec<LinePart> {
let prefix_text = " Zellij ".to_string();
let prefix_text_len = prefix_text.chars().count();
- 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 locked_mode_color = palette.magenta;
- let normal_mode_color = palette.green;
- let other_modes_color = palette.orange;
+ let text_color = palette.text_unselected.base;
+ let bg_color = palette.text_unselected.background;
+ let locked_mode_color = palette.text_unselected.emphasis_3;
+ let normal_mode_color = palette.text_unselected.emphasis_2;
+ let other_modes_color = palette.text_unselected.emphasis_0;
let prefix_styled_text = style!(text_color, bg_color).bold().paint(prefix_text);
let mut parts = vec![LinePart {
@@ -201,10 +197,6 @@ fn tab_line_prefix(
if let Some(name) = session_name {
let name_part = format!("({})", name);
let name_part_len = name_part.width();
- 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 {
@@ -253,7 +245,7 @@ pub fn tab_line(
mut all_tabs: Vec<LinePart>,
active_tab_index: usize,
cols: usize,
- palette: Palette,
+ palette: Styling,
capabilities: PluginCapabilities,
hide_session_name: bool,
mode: InputMode,
@@ -293,6 +285,7 @@ pub fn tab_line(
let current_title_len = get_current_title_len(&prefix);
if current_title_len < cols {
let mut remaining_space = cols - current_title_len;
+ let remaining_bg = palette.text_unselected.background;
if let Some(swap_layout_status) = swap_layout_status(
remaining_space,
active_swap_layout_name,
@@ -304,7 +297,7 @@ pub fn tab_line(
remaining_space -= swap_layout_status.len;
let mut buffer = String::new();
for _ in 0..remaining_space {
- buffer.push_str(&style!(palette.black, palette.black).paint(" ").to_string());
+ buffer.push_str(&style!(remaining_bg, remaining_bg).paint(" ").to_string());
}
prefix.push(LinePart {
part: buffer,
@@ -323,7 +316,7 @@ fn swap_layout_status(
swap_layout_name: &Option<String>,
is_swap_layout_damaged: bool,
input_mode: InputMode,
- palette: &Palette,
+ palette: &Styling,
separator: &str,
) -> Option<LinePart> {
match swap_layout_name {
@@ -331,31 +324,28 @@ fn swap_layout_status(
let mut swap_layout_name = format!(" {} ", swap_layout_name);
swap_layout_name.make_ascii_uppercase();
let swap_layout_name_len = swap_layout_name.len() + 3;
+ let bg = palette.text_unselected.background;
+ let fg = palette.ribbon_unselected.background;
+ let green = palette.ribbon_selected.background;
let (prefix_separator, swap_layout_name, suffix_separator) =
if input_mode == InputMode::Locked {
(
- style!(palette.black, palette.fg).paint(separator),
- style!(palette.black, palette.fg)
- .italic()
- .paint(&swap_layout_name),
- style!(palette.fg, palette.black).paint(separator),
+ style!(bg, fg).paint(separator),
+ style!(bg, fg).italic().paint(&swap_layout_name),
+ style!(fg, bg).paint(separator),
)
} else if is_swap_layout_damaged {
(
- style!(palette.black, palette.fg).paint(separator),
- style!(palette.black, palette.fg)
- .bold()
- .paint(&swap_layout_name),
- style!(palette.fg, palette.black).paint(separator),
+ style!(bg, fg).paint(separator),
+ style!(bg, fg).bold().paint(&swap_layout_name),
+ style!(fg, bg).paint(separator),
)
} else {
(
- style!(palette.black, palette.green).paint(separator),
- style!(palette.black, palette.green)
- .bold()
- .paint(&swap_layout_name),
- style!(palette.green, palette.black).paint(separator),
+ style!(bg, green).paint(separator),
+ style!(bg, green).bold().paint(&swap_layout_name),
+ style!(green, bg).paint(separator),
)
};
let swap_layout_indicator = format!(
diff --git a/default-plugins/compact-bar/src/main.rs b/default-plugins/compact-bar/src/main.rs
index a7a19bd0..567dc187 100644
--- a/default-plugins/compact-bar/src/main.rs
+++ b/default-plugins/compact-bar/src/main.rs
@@ -131,10 +131,7 @@ impl ZellijPlugin for State {
.tab_line
.iter()
.fold(String::new(), |output, part| output + &part.part);
- 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;
match background {
PaletteColor::Rgb((r, g, b)) => {
print!("{}\u{1b}[48;2;{};{};{}m\u{1b}[0K", output, r, g, b);
diff --git a/default-plugins/compact-bar/src/tab.rs b/default-plugins/compact-bar/src/tab.rs
index ec711cc9..68609b23 100644
--- a/default-plugins/compact-bar/src/tab.rs
+++ b/default-plugins/compact-bar/src/tab.rs
@@ -4,12 +4,12 @@ use unicode_width::UnicodeWidthStr;
use zellij_tile::prelude::*;
use zellij_tile_utils::style;
-fn cursors(focused_clients: &[ClientId], palette: Palette) -> (Vec<ANSIString>, usize) {
+fn cursors(focused_clients: &[ClientId], colors: MultiplayerColors) -> (Vec<ANSIString>, usize) {
// cursor section, text length
let mut len = 0;
let mut cursors = vec![];
for client_id in focused_clients.iter() {
- if let Some(color) = client_id_to_colors(*client_id, palette) {
+ if let Some(color) = client_id_to_colors(*client_id, colors) {
cursors.push(style!(color.1, color.0).paint(" "));
len += 1;
}
@@ -21,37 +21,40 @@ pub fn render_tab(
text: String,
tab: &TabInfo,
is_alternate_tab: bool,
- palette: Palette,
+ palette: Styling,
separator: &str,
) -> LinePart {
let focused_clients = tab.other_focused_clients.as_slice();
let separator_width = separator.width();
- let alternate_tab_color = match palette.theme_hue {
- // TODO: only do this if we don't have the arrow capabilities
- ThemeHue::Dark => palette.white,
- ThemeHue::Light => palette.black,
+ let alternate_tab_color = if is_alternate_tab {
+ palette.ribbon_unselected.emphasis_1
+ } else {
+ palette.ribbon_unselected.background
};
let background_color = if tab.active {
- palette.green
+ palette.ribbon_selected.background
} else if is_alternate_tab {
alternate_tab_color
} else {
- palette.fg
+ palette.ribbon_unselected.background
};
- let foreground_color = match palette.theme_hue {
- ThemeHue::Dark => palette.black,
- ThemeHue::Light => palette.white,
+ let foreground_color = if tab.active {
+ palette.ribbon_selected.base
+ } else {
+ palette.ribbon_unselected.base
};
- let left_separator = style!(foreground_color, background_color).paint(separator);
+ let separator_fill_color = palette.text_unselected.background;
+ let left_separator = style!(separator_fill_color, background_color).paint(separator);
let mut tab_text_len = text.width() + (separator_width * 2) + 2; // + 2 for padding
let tab_styled_text = style!(foreground_color, background_color)
.bold()
.paint(format!(" {} ", text));
- let right_separator = style!(background_color, foreground_color).paint(separator);
+ let right_separator = style!(background_color, separator_fill_color).paint(separator);
let tab_styled_text = if !focused_clients.is_empty() {
- let (cursor_section, extra_length) = cursors(focused_clients, palette);
+ let (cursor_section, extra_length) =
+ cursors(focused_clients, palette.multiplayer_user_colors);
tab_text_len += extra_length;
let mut s = String::new();
let cursor_beginning = style!(foreground_color, background_color)
@@ -85,7 +88,7 @@ pub fn tab_style(
mut tabname: String,
tab: &TabInfo,
mut is_alternate_tab: bool,
- palette: Palette,
+ palette: Styling,
capabilities: PluginCapabilities,
) -> LinePart {
let separator = tab_separator(capabilities);
diff --git a/default-plugins/configuration/src/main.rs b/default-plugins/configuration/src/main.rs
index afc08bf5..6a9c6fc9 100644
--- a/default-plugins/configuration/src/main.rs
+++ b/default-plugins/configuration/src/main.rs
@@ -71,7 +71,7 @@ struct State {
ui_size: usize,
current_screen: Screen,
latest_mode_info: Option<ModeInfo>,
- colors: Palette,
+ colors: Styling,
}
impl Default for State {
@@ -82,7 +82,7 @@ impl Default for State {
ui_size: UI_SIZE,
current_screen: Screen::default(),
latest_mode_info: None,
- colors: Palette::default(),
+ colors: Palette::default().into(),
}
}
}
diff --git a/default-plugins/configuration/src/ui_components.rs b/default-plugins/configuration/src/ui_components.rs
index 4ccccf9c..7440fc56 100644
--- a/default-plugins/configuration/src/ui_components.rs
+++ b/default-plugins/configuration/src/ui_components.rs
@@ -1,11 +1,8 @@
use crate::{Screen, WIDTH_BREAKPOINTS};
use zellij_tile::prelude::*;
-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,
- };
+pub fn top_tab_menu(cols: usize, current_screen: &Screen, colors: &Styling) {
+ let background = colors.text_unselected.background;
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),
diff --git a/default-plugins/plugin-manager/src/main.rs b/default-plugins/plugin-manager/src/main.rs
index 22b215ef..c148a7ba 100644
--- a/default-plugins/plugin-manager/src/main.rs
+++ b/default-plugins/plugin-manager/src/main.rs
@@ -34,7 +34,7 @@ pub struct NewPluginScreen {
selected_config_index: Option<usize>,
request_ids: Vec<String>,
load_in_background: bool,
- colors: Palette,
+ colors: Styling,
}
impl Default for NewPluginScreen {
@@ -50,13 +50,13 @@ impl Default for NewPluginScreen {
selected_config_index: None,
request_ids: vec![],
load_in_background: false,
- colors: Palette::default(),
+ colors: Palette::default().into(),
}
}
}
impl NewPluginScreen {
- pub fn new(colors: Palette) -> Self {
+ pub fn new(colors: Styling) -> Self {
Self {
colors,
..Default::default()
@@ -261,10 +261,7 @@ impl NewPluginScreen {
None,
None,
);
- let background = match self.colors.theme_hue {
- ThemeHue::Dark => self.colors.black,
- ThemeHue::Light => self.colors.white,
- };
+ let background = self.colors.text_unselected.background;
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),
@@ -496,7 +493,7 @@ struct State {
plugin_id_to_tab_position: HashMap<u32, usize>,
search_term: String,
new_plugin_screen: Option<NewPluginScreen>,
- colors: Palette,
+ colors: Styling,
}
register_plugin!(State);
diff --git a/default-plugins/session-manager/src/main.rs b/default-plugins/session-manager/src/main.rs
index 8dd6da87..ba6ef55d 100644
--- a/default-plugins/session-manager/src/main.rs
+++ b/default-plugins/session-manager/src/main.rs
@@ -122,10 +122,7 @@ impl ZellijPlugin for State {
fn render(&mut self, rows: usize, cols: usize) {
let (x, y, width, height) = self.main_menu_size(rows, cols);
- let background = match self.colors.palette.theme_hue {
- ThemeHue::Dark => self.colors.palette.black,
- ThemeHue::Light => self.colors.palette.white,
- };
+ let background = self.colors.palette.text_unselected.background;
if self.is_welcome_screen {
render_banner(x, 0, rows.saturating_sub(height), width);
diff --git a/default-plugins/session-manager/src/ui/components.rs b/default-plugins/session-manager/src/ui/components.rs
index 03c4d328..dede06d9 100644
--- a/default-plugins/session-manager/src/ui/components.rs
+++ b/default-plugins/session-manager/src/ui/components.rs
@@ -83,9 +83,14 @@ impl ListItem {
let mut remaining_cols = max_cols;
for span in session_name {
span.render(
- indices
- .clone()
- .map(|i| (SpanStyle::ForegroundBold(self.colors.palette.magenta), i)),
+ indices.clone().map(|i| {
+ (
+ SpanStyle::ForegroundBold(
+ self.colors.palette.text_unselected.emphasis_3,
+ ),
+ i,
+ )
+ }),
&mut line_to_render,
&mut remaining_cols,
);
@@ -102,9 +107,14 @@ impl ListItem {
let mut remaining_cols = max_cols;
for span in tab_name {
span.render(
- indices
- .clone()
- .map(|i| (SpanStyle::ForegroundBold(self.colors.palette.magenta), i)),
+ indices.clone().map(|i| {
+ (
+ SpanStyle::ForegroundBold(
+ self.colors.palette.text_unselected.emphasis_3,
+ ),
+ i,
+ )
+ }),
&mut line_to_render,
&mut remaining_cols,
);
@@ -116,9 +126,14 @@ impl ListItem {
let mut remaining_cols = max_cols;
for span in pane_name {
span.render(
- indices
- .clone()
- .map(|i| (SpanStyle::ForegroundBold(self.colors.palette.magenta), i)),
+ indices.clone().map(|i| {
+ (
+ SpanStyle::ForegroundBold(
+ self.colors.palette.text_unselected.emphasis_3,
+ ),
+ i,
+ )
+ }),
&mut line_to_render,
&mut remaining_cols,
);
@@ -297,11 +312,11 @@ impl LineToRender {
pub fn make_selected_as_search(&mut self, add_arrows: bool) {
self.is_selected = true;
let arrows = if add_arrows {
- self.colors.magenta(" <↓↑> ")
+ self.colors.shortcuts(" <↓↑> ")
} else {
" ".to_owned()
};
- match self.colors.palette.bg {
+ match self.colors.palette.list_selected.background {
PaletteColor::EightBit(byte) => {
self.line = format!(
"\u{1b}[48;5;{byte}m\u{1b}[K\u{1b}[48;5;{byte}m{arrows}{}",
@@ -319,11 +334,11 @@ impl LineToRender {
pub fn make_selected(&mut self, add_arrows: bool) {
self.is_selected = true;
let arrows = if add_arrows {
- self.colors.magenta("<←↓↑→>")
+ self.colors.shortcuts("<←↓↑→>")
} else {
" ".to_owned()
};
- match self.colors.palette.bg {
+ match self.colors.palette.list_selected.background {
PaletteColor::EightBit(byte) => {
self.line = format!(
"\u{1b}[48;5;{byte}m\u{1b}[K\u{1b}[48;5;{byte}m{arrows}{}",
@@ -343,7 +358,7 @@ impl LineToRender {
let more = if self.truncated_result_count > 0 {
self.colors
- .red(&format!(" [+{}]", self.truncated_result_count))
+ .exit_code_error(&format!(" [+{}]", self.truncated_result_count))
} else {
String::new()
};
@@ -368,12 +383,12 @@ pub fn build_session_ui_line(session_ui_info: &SessionUiInfo, colors: Colors) ->
.iter()
.fold(0, |acc, tab| acc + tab.panes.len());
let tab_count = format!("{}", tab_count_text);
- let tab_count_styled = colors.cyan(&tab_count);
+ let tab_count_styled = colors.tab_count(&tab_count);
let total_pane_count = format!("{}", total_pane_count_text);
- let total_pane_count_styled = colors.green(&total_pane_count);
+ let total_pane_count_styled = colors.pane_count(&total_pane_count);
let session_name = &session_ui_info.name;
let connected_users = format!("{}", session_ui_info.connected_users);
- let connected_users_styled = colors.orange(&connected_users);
+ let connected_users_styled = colors.connected_users(&connected_users);
let session_bullet_span =
UiSpan::UiSpanTelescope(UiSpanTelescope::new(vec![StringAndLength::new(
format!(" > "),
@@ -381,7 +396,7 @@ pub fn build_session_ui_line(session_ui_info: &SessionUiInfo, colors: Colors) ->
)]));
let session_name_span = UiSpan::TruncatableUiSpan(TruncatableUiSpan::new(
session_name.clone(),
- SpanStyle::ForegroundBold(colors.palette.orange),
+ SpanStyle::ForegroundBold(colors.palette.text_unselected.emphasis_0),
));
let tab_and_pane_count = UiSpan::UiSpanTelescope(UiSpanTelescope::new(vec![
StringAndLength::new(
@@ -409,9 +424,12 @@ pub fn build_session_ui_line(session_ui_info: &SessionUiInfo, colors: Colors) ->
ui_spans.push(connected_users_count);
if session_ui_info.is_current_session {
let current_session_indication = UiSpan::UiSpanTelescope(UiSpanTelescope::new(vec![
- StringAndLength::new(colors.orange(&format!(" <CURRENT SESSION>")), 18),
- StringAndLength::new(colors.orange(&format!(" <CURRENT>")), 10),
- StringAndLength::new(colors.orange(&format!(" <C>")), 4),
+ StringAndLength::new(
+ colors.current_session_marker(&format!(" <CURRENT SESSION>")),
+ 18,
+ ),
+ StringAndLength::new(colors.current_session_marker(&format!(" <CURRENT>")), 10),
+ StringAndLength::new(colors.current_session_marker(&format!(" <C>")), 4),
]));
ui_spans.push(current_session_indication);
}
@@ -423,7 +441,7 @@ pub fn build_tab_ui_line(tab_ui_info: &TabUiInfo, colors: Colors) -> Vec<UiSpan>
let tab_name = &tab_ui_info.name;
let pane_count_text = tab_ui_info.panes.len();
let pane_count = format!("{}", pane_count_text);
- let pane_count_styled = colors.green(&pane_count);
+ let pane_count_styled = colors.pane_count(&pane_count);
let tab_bullet_span =
UiSpan::UiSpanTelescope(UiSpanTelescope::new(vec![StringAndLength::new(
format!(" - "),
@@ -431,7 +449,7 @@ pub fn build_tab_ui_line(tab_ui_info: &TabUiInfo, colors: Colors) -> Vec<UiSpan>
)]));
let tab_name_span = UiSpan::TruncatableUiSpan(TruncatableUiSpan::new(
tab_name.clone(),
- SpanStyle::ForegroundBold(colors.palette.cyan),
+ SpanStyle::ForegroundBold(colors.palette.text_unselected.emphasis_1),
));
let connected_users_count_span = UiSpan::UiSpanTelescope(UiSpanTelescope::new(vec![
StringAndLength::new(
@@ -455,9 +473,9 @@ pub fn build_pane_ui_line(pane_ui_info: &PaneUiInfo, colors: Colors) -> Vec<UiSp
let exit_code = pane_ui_info.exit_code.map(|exit_code_number| {
let exit_code = format!("{}", exit_code_number);
let exit_code = if exit_code_number == 0 {
- colors.green(&exit_code)
+ colors.session_and_folder_entry(&exit_code)
} else {
- colors.red(&exit_code)
+ colors.exit_code_error(&exit_code)
};
exit_code
});
@@ -505,7 +523,7 @@ pub fn minimize_lines(
}
pub fn render_prompt(search_term: &str, colors: Colors, x: usize, y: usize) {
- let prompt = colors.green(&format!("Search:"));
+ let prompt = colors.session_and_folder_entry(&format!("Search:"));
let search_term = colors.bold(&format!("{}_", search_term));
println!(
"\u{1b}[{};{}H\u{1b}[0m{} {}\n",
@@ -581,10 +599,10 @@ fn render_new_session_folder_prompt(
let new_session_path = new_session_folder.clone();
let new_session_folder = new_session_folder.display().to_string();
let change_folder_shortcut_text = "<Ctrl f>";
- let change_folder_shortcut = colors.magenta(&change_folder_shortcut_text);
+ let change_folder_shortcut = colors.shortcuts(&change_folder_shortcut_text);
let to_change = "to change";
let reset_folder_shortcut_text = "<Ctrl c>";
- let reset_folder_shortcut = colors.magenta(reset_folder_shortcut_text);
+ let reset_folder_shortcut = colors.shortcuts(reset_folder_shortcut_text);
let to_reset = "to reset";
if max_cols
>= folder_prompt.width()
@@ -598,8 +616,8 @@ fn render_new_session_folder_prompt(
print!(
"\u{1b}[m{}{} {} ({} {}, {} {})",
format!("\u{1b}[{};{}H", y + 1, x + 1),
- colors.green(folder_prompt),
- colors.orange(&new_session_folder),
+ colors.session_name_prompt(folder_prompt),
+ colors.session_and_folder_entry(&new_session_folder),
change_folder_shortcut,
to_change,
reset_folder_shortcut,
@@ -617,8 +635,8 @@ fn render_new_session_folder_prompt(
print!(
"\u{1b}[m{}{} {} ({} {}, {} {})",
format!("\u{1b}[{};{}H", y + 1, x + 1),
- colors.green(short_folder_prompt),
- colors.orange(&new_session_folder),
+ colors.session_name_prompt(short_folder_prompt),
+ colors.session_and_folder_entry(&new_session_folder),
change_folder_shortcut,
to_change,
reset_folder_shortcut,
@@ -634,8 +652,8 @@ fn render_new_session_folder_prompt(
print!(
"\u{1b}[m{}{} {} ({}/{})",
format!("\u{1b}[{};{}H", y + 1, x + 1),
- colors.green(short_folder_prompt),
- colors.orange(&new_session_folder),
+ colors.session_name_prompt(short_folder_prompt),
+ colors.session_and_folder_entry(&new_session_folder),
change_folder_shortcut,
reset_folder_shortcut,
);
@@ -652,8 +670,8 @@ fn render_new_session_folder_prompt(
print!(
"\u{1b}[m{}{} {} ({}/{})",
format!("\u{1b}[{};{}H", y + 1, x + 1),
- colors.green(short_folder_prompt),
- colors.orange(&truncated_path),
+ colors.session_name_prompt(short_folder_prompt),
+ colors.session_and_folder_entry(&truncated_path),
change_folder_shortcut,
reset_folder_shortcut,
);
@@ -663,7 +681,7 @@ fn render_new_session_folder_prompt(
let folder_prompt = "New session folder:";
let short_folder_prompt = "Folder:";
let change_folder_shortcut_text = "<Ctrl f>";
- let change_folder_shortcut = colors.magenta(change_folder_shortcut_text);
+ let change_folder_shortcut = colors.shortcuts(change_folder_shortcut_text);
let to_set = "to set";
if max_cols
@@ -672,7 +690,7 @@ fn render_new_session_folder_prompt(
print!(
"\u{1b}[m{}{} ({} {})",
format!("\u{1b}[{};{}H", y + 1, x + 1),
- colors.green(folder_prompt),
+ colors.session_name_prompt(folder_prompt),
change_folder_shortcut,
to_set,
);
@@ -685,7 +703,7 @@ fn render_new_session_folder_prompt(
print!(
"\u{1b}[m{}{} ({} {})",
format!("\u{1b}[{};{}H", y + 1, x + 1),
- colors.green(short_folder_prompt),
+ colors.session_name_prompt(short_folder_prompt),
change_folder_shortcut,
to_set,
);
@@ -693,7 +711,7 @@ fn render_new_session_folder_prompt(
print!(
"\u{1b}[m{}{} {}",
format!("\u{1b}[{};{}H", y + 1, x + 1),
- colors.green(short_folder_prompt),
+ colors.session_name_prompt(short_folder_prompt),
change_folder_shortcut,
);
}
@@ -709,7 +727,7 @@ pub fn render_new_session_block(
x: usize,
y: usize,
) {
- let enter = colors.magenta("<ENTER>");
+ let enter = colors.shortcuts("<ENTER>");
if new_session_info.entering_new_session_name() {
let prompt = "New session name:";
let long_instruction = "when done, blank for random";
@@ -720,8 +738,8 @@ pub fn render_new_session_block(
println!(
"\u{1b}[m{}{} {}_ ({} {})",
format!("\u{1b}[{};{}H", y + 1, x + 1),
- colors.green(prompt),
- colors.orange(&new_session_name),
+ colors.session_name_prompt(prompt),
+ colors.session_and_folder_entry(&new_session_name),
enter,
long_instruction,
);
@@ -746,8 +764,8 @@ pub fn render_new_session_block(
println!(
"\u{1b}[m{}{} {}_ {}",
format!("\u{1b}[{};{}H", y + 1, x + 1),
- colors.green(prompt),
- colors.orange(&new_session_name),
+ colors.session_name_prompt(prompt),
+ colors.session_and_folder_entry(&new_session_name),
enter,
);
}
@@ -759,23 +777,23 @@ pub fn render_new_session_block(
};
let prompt = "New session name:";
let long_instruction = "to correct";
- let esc = colors.magenta("<ESC>");
+ let esc = colors.shortcuts("<ESC>");
if max_cols_of_new_session_block
> prompt.width() + long_instruction.width() + new_session_name.width() + 15
{
println!(
"\u{1b}[m{}{}: {} ({} to correct)",
format!("\u{1b}[{};{}H", y + 1, x + 1),
- colors.green("New session name"),
- colors.orange(new_session_name),
+ colors.session_name_prompt(prompt),
+ colors.session_and_folder_entry(new_session_name),
esc,
);
} else {
println!(
"\u{1b}[m{}{}: {} {}",
format!("\u{1b}[{};{}H", y + 1, x + 1),
- colors.green("New session name"),
- colors.orange(new_session_name),
+ colors.session_name_prompt("New session name"),
+ colors.session_and_folder_entry(new_session_name),
esc,
);
}
@@ -919,13 +937,13 @@ pub fn render_controls_line(
}
},
ActiveScreen::AttachToSession => {
- let rename = colors.magenta("<Ctrl r>");
+ let rename = colors.shortcuts("<Ctrl r>");
let rename_text = colors.bold("Rename");
- let disconnect = colors.magenta("<Ctrl x>");
+ let disconnect = colors.shortcuts("<Ctrl x>");
let disconnect_text = colors.bold("Disconnect others");
- let kill = colors.magenta("<Del>");
+ let kill = colors.shortcuts("<Del>");
let kill_text = colors.bold("Kill");
- let kill_all = colors.magenta("<Ctrl d>");
+ let kill_all = colors.shortcuts("<Ctrl d>");
let kill_all_text = colors.bold("Kill all");
if max_cols > 90 {
@@ -937,13 +955,13 @@ pub fn render_controls_line(
}
},
ActiveScreen::ResurrectSession => {
- let arrows = colors.magenta("<↓↑>");
+ let arrows = colors.shortcuts("<↓↑>");
let navigate = colors.bold("Navigate");
- let enter = colors.magenta("<ENTER>");
+ let enter = colors.shortcuts("<ENTER>");
let select = colors.bold("Resurrect");
- let del = colors.magenta("<DEL>");
+ let del = colors.shortcuts("<DEL>");
let del_text = colors.bold("Delete");
- let del_all = colors.magenta("<Ctrl d>");
+ let del_all = colors.shortcuts("<Ctrl d>");
let del_all_text = colors.bold("Delete all");
if max_cols > 83 {
@@ -957,12 +975,18 @@ pub fn render_controls_line(
}
}
+// Maps the various prompts and UI elements to the colors to present them with
+//
+// Since this plugin predates the UI components, this is a developer
+// convenience to keep the coloration of dialogs organized by descriptive names
+//
+// It will be obviated once everything is migrated to UI components from zellij-tile
#[derive(Debug, Default, Clone, Copy)]
pub struct Colors {
- pub palette: Palette,
+ pub palette: Styling,
}
impl Colors {
- pub fn new(palette: Palette) -> Self {
+ pub fn new(palette: Styling) -> Self {
Colors { palette }
}
pub fn bold(&self, text: &str) -> String {
@@ -979,24 +1003,37 @@ impl Colors {
},
}
}
- pub fn orange(&self, text: &str) -> String {
- self.color(&self.palette.orange, text)
+
+ pub fn session_name_prompt(&self, text: &str) -> String {
+ self.color(&self.palette.exit_code_success.base, text)
+ }
+
+ pub fn connected_users(&self, text: &str) -> String {
+ self.color(&self.palette.text_unselected.emphasis_2, text)
+ }
+
+ pub fn session_and_folder_entry(&self, text: &str) -> String {
+ self.color(&self.palette.text_unselected.emphasis_0, text)
+ }
+
+ pub fn current_session_marker(&self, text: &str) -> String {
+ self.color(&self.palette.text_unselected.emphasis_0, text)
}
- pub fn green(&self, text: &str) -> String {
- self.color(&self.palette.green, text)
+ pub fn pane_count(&self, text: &str) -> String {
+ self.color(&self.palette.text_unselected.emphasis_2, text)
}
- pub fn red(&self, text: &str) -> String {
- self.color(&self.palette.red, text)
+ pub fn exit_code_error(&self, text: &str) -> String {
+ self.color(&self.palette.exit_code_error.base, text)
}
- pub fn cyan(&self, text: &str) -> String {
- self.color(&self.palette.cyan, text)
+ pub fn tab_count(&self, text: &str) -> String {
+ self.color(&self.palette.text_unselected.emphasis_1, text)
}
- pub fn magenta(&self, text: &str) -> String {
- self.color(&self.palette.magenta, text)
+ pub fn shortcuts(&self, text: &str) -> String {
+ self.color(&self.palette.text_unselected.emphasis_3, text)
}
}
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![
Style::new().paint(" Tip: "),
@@ -43,7 +43,7 @@ pub fn compact_layout_full(help: &ModeInfo) -> LinePart {
pub fn compact_layout_medium(help: &ModeInfo) -> LinePart {
// Tip: To save screen 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![
Style::new().paint(" Tip: "),
@@ -61,7 +61,7 @@ pub fn compact_layout_medium(help: &ModeInfo) -> LinePart {
pub fn compact_layout_short(help: &ModeInfo) -> LinePart {
// Save screen 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![
Style::new().paint(" Save screen space, start with: "),
diff --git a/default-plugins/status-bar/src/tip/data/edit_scrollbuffer.rs b/default-plugins/status-bar/src/tip/data/edit_scrollbuffer.rs
index ebd944b7..033dd61d 100644
--- a/default-plugins/status-bar/src/tip/data/edit_scrollbuffer.rs
+++ b/default-plugins/status-bar/src/tip/data/edit_scrollbuffer.rs
@@ -24,7 +24,7 @@ macro_rules! strings {
pub fn edit_scrollbuffer_full(help: &ModeInfo) -> LinePart {
// Tip: Search through the scrollbuffer using your default $EDITOR with
// Ctrl + <s> + <e>
- 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![
Style::new().paint(" Tip: "),
@@ -39,7 +39,7 @@ pub fn edit_scrollbuffer_full(help: &ModeInfo) -> LinePart {
pub fn edit_scrollbuffer_medium(help: &ModeInfo) -> LinePart {
// Tip: Search the scrollbuffer using your $EDITOR with
// Ctrl + <s> + <e>
- 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![
Style::new().paint(" Tip: "),
@@ -54,7 +54,7 @@ pub fn edit_scrollbuffer_medium(help: &ModeInfo) -> LinePart {
pub fn edit_scrollbuffer_short(help: &ModeInfo) -> LinePart {
// Search using $EDITOR with
// Ctrl + <s> + <e>
- 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![
Style::new().paint(" Search using "),
diff --git a/default-plugins/status-bar/src/tip/data/move_tabs.rs b/default-plugins/status-bar/src/tip/data/move_tabs.rs
index 6ad119e4..1679b6b0 100644
--- a/default-plugins/status-bar/src/tip/data/move_tabs.rs
+++ b/default-plugins/status-bar/src/tip/data/move_tabs.rs
@@ -25,7 +25,7 @@ macro_rules! strings {
pub fn move_tabs_full(help: &ModeInfo) -> LinePart {
// Tip: Wrong order of tabs? You can move them to left and right with:
// Alt + i (left) and Alt + o (right)
- let green_color = palette_match!(help.style.colors.green);
+ let green_color = palette_match!(help.style.colors.text_unselected.emphasis_2);
let bits = vec![
Style::new().paint(" Tip: "),
@@ -41,7 +41,7 @@ pub fn move_tabs_full(help: &ModeInfo) -> LinePart {
pub fn move_tabs_medium(help: &ModeInfo) -> LinePart {
// Tip: You can move tabs to left and right with:
// Alt + i (left) and Alt + o (right)
- let green_color = palette_match!(help.style.colors.green);
+ let green_color = palette_match!(help.style.colors.text_unselected.emphasis_2);
let bits = vec![
Style::new().paint(" Tip: "),
@@ -56,7 +56,7 @@ pub fn move_tabs_medium(help: &ModeInfo) -> LinePart {
pub fn move_tabs_short(help: &ModeInfo) -> LinePart {
// Move tabs with: Alt + i (left) and Alt + o (right)
- let green_color = palette_match!(help.style.colors.green);
+ let green_color = palette_match!(help.style.colors.text_unselected.emphasis_2);
let bits = vec![
Style::new().paint(" Move tabs with: "),
diff --git a/default-plugins/status-bar/src/tip/data/send_mouse_click_to_terminal.rs b/default-plugins/status-bar/src/tip/data/send_mouse_click_to_terminal.rs
index 7daabeb6..62639b30 100644
--- a/default-plugins/status-bar/src/tip/data/send_mouse_click_to_terminal.rs
+++ b/default-plugins/status-bar/src/tip/data/send_mouse_click_to_terminal.rs
@@ -23,8 +23,8 @@ macro_rules! strings {
pub fn mouse_click_to_terminal_full(help: &ModeInfo) -> LinePart {
// Tip: SHIFT + <mouse-click> bypasses Zellij and sends the mouse click directly to the terminal
- let green_color = palette_match!(help.style.colors.green);
- let orange_color = palette_match!(help.style.colors.orange);
+ let green_color = palette_match!(help.style.colors.text_unselected.emphasis_2);
+ let orange_color = palette_match!(help.style.colors.text_unselected.emphasis_0);
strings!(&[
Style::new().paint(" Tip: "),
@@ -37,8 +37,8 @@ pub fn mouse_click_to_terminal_full(help: &ModeInfo) -> LinePart {
pub fn mouse_click_to_terminal_medium(help: &ModeInfo) -> LinePart {
// Tip: SHIFT + <mouse-click> sends the click directly to the terminal
- let green_color = palette_match!(help.style.colors.green);
- let orange_color = palette_match!(help.style.colors.orange);
+ let green_color = palette_match!(help.style.colors.text_unselected.emphasis_2);
+ let orange_color = palette_match!(help.style.colors.text_unselected.emphasis_0);
strings!(&[
Style::new().paint(" Tip: "),
Style::new().fg(orange_color).bold().paint("Shift"),
@@ -50,8 +50,8 @@ pub fn mouse_click_to_terminal_medium(help: &ModeInfo) -> LinePart {
pub fn mouse_click_to_terminal_short(help: &ModeInfo) -> LinePart {
// Tip: SHIFT + <mouse-click> => sends click to terminal.
- let green_color = palette_match!(help.style.colors.green);
- let orange_color = palette_match!(help.style.colors.orange);
+ let green_color = palette_match!(help.style.colors.text_unselected.emphasis_2);
+ let orange_color = palette_match!(help.style.colors.text_unselected.emphasis_0);
strings!(&[
Style::new().paint(" Tip: "),
diff --git a/default-plugins/status-bar/src/tip/data/use_mouse.rs b/default-plugins/status-bar/src/tip/data/use_mouse.rs
index 4bbfbf94..a30d5fae 100644
--- a/default-plugins/status-bar/src/tip/data/use_mouse.rs
+++ b/default-plugins/status-bar/src/tip/data/use_mouse.rs
@@ -24,7 +24,7 @@ macro_rules! strings {
pub fn use_mouse_full(help: &ModeInfo) -> LinePart {
// Tip: Use the mouse to switch pane focus, scroll through the pane
// scrollbuffer, switch or scroll through tabs
- let green_color = palette_match!(help.style.colors.green);
+ let green_color = palette_match!(help.style.colors.text_unselected.emphasis_2);
strings!(&[
Style::new().paint(" Tip: "),
@@ -36,7 +36,7 @@ pub fn use_mouse_full(help: &ModeInfo) -> LinePart {
pub fn use_mouse_medium(help: &ModeInfo) -> LinePart {
// Tip: Use the mouse to switch panes/tabs or scroll through the pane
// scrollbuffer
- let green_color = palette_match!(help.style.colors.green);
+ let green_color = palette_match!(help.style.colors.text_unselected.emphasis_2);
strings!(&[
Style::new().paint(" Tip: "),
@@ -47,7 +47,7 @@ pub fn use_mouse_medium(help: &ModeInfo) -> LinePart {
pub fn use_mouse_short(help: &ModeInfo) -> LinePart {
// Tip: Use the mouse to switch panes/tabs or scroll
- let green_color = palette_match!(help.style.colors.green);
+ let green_color = palette_match!(help.style.colors.text_unselected.emphasis_2);
strings!(&[
Style::new().fg(green_color).bold().paint(" Use the mouse"),
diff --git a/default-plugins/status-bar/src/tip/data/zellij_setup_check.rs b/default-plugins/status-bar/src/tip/data/zellij_setup_check.rs
index 3dd7b6d8..6d5a2920 100644
--- a/default-plugins/status-bar/src/tip/data/zellij_setup_check.rs
+++ b/default-plugins/status-bar/src/tip/data/zellij_setup_check.rs
@@ -23,7 +23,7 @@ macro_rules! strings {
pub fn zellij_setup_check_full(help: &ModeInfo) -> LinePart {
// Tip: Having issues with Zellij? Try running "zellij setup --check"
- let orange_color = palette_match!(help.style.colors.orange);
+ let orange_color = palette_match!(help.style.colors.text_unselected.emphasis_0);
strings!(&[
Style::new().paint(" Tip: "),
@@ -37,7 +37,7 @@ pub fn zellij_setup_check_full(help: &ModeInfo) -> LinePart {
pub fn zellij_setup_check_medium(help: &ModeInfo) -> LinePart {
// Tip: Run "zellij setup --check" to find issues
- let orange_color = palette_match!(help.style.colors.orange);
+ let orange_color = palette_match!(help.style.colors.text_unselected.emphasis_0);
strings!(&[
Style::new().paint(" Tip: "),
@@ -52,7 +52,7 @@ pub fn zellij_setup_check_medium(help: &ModeInfo) -> LinePart {
pub fn zellij_setup_check_short(help: &ModeInfo) -> LinePart {
// Run "zellij setup --check" to find issues
- let orange_color = palette_match!(help.style.colors.orange);
+ let orange_color = palette_match!(help.style.colors.text_unselected.emphasis_0);
strings!(&[
Style::new().paint(" Run "),
diff --git a/default-plugins/tab-bar/src/line.rs b/default-plugins/tab-bar/src/line.rs
index d9f82698..7f564a3d 100644
--- a/default-plugins/tab-bar/src/line.rs
+++ b/default-plugins/tab-bar/src/line.rs
@@ -17,7 +17,7 @@ fn populate_tabs_in_tab_line(
tabs_after_active: &mut Vec<LinePart>,
tabs_to_render: &mut Vec<LinePart>,
cols: usize,
- palette: Palette,
+ palette: Styling,
capabilities: PluginCapabilities,
) {
let mut middle_size = get_current_title_len(tabs_to_render);
@@ -109,7 +109,7 @@ fn populate_tabs_in_tab_line(
fn left_more_message(
tab_count_to_the_left: usize,
- palette: Palette,
+ palette: Styling,
separator: &str,
tab_index: usize,
) -> LinePart {
@@ -124,13 +124,15 @@ fn left_more_message(
// 238
// chars length plus separator length on both sides
let more_text_len = more_text.width() + 2 * separator.width();
- let (text_color, sep_color) = match palette.theme_hue {
- ThemeHue::Dark => (palette.white, palette.black),
- ThemeHue::Light => (palette.black, palette.white),
- };
- let left_separator = style!(sep_color, palette.orange).paint(separator);
- let more_styled_text = style!(text_color, palette.orange).bold().paint(more_text);
- let right_separator = style!(palette.orange, sep_color).paint(separator);
+ let (text_color, sep_color) = (
+ palette.ribbon_unselected.base,
+ palette.text_unselected.background,
+ );
+ let left_separator = style!(sep_color, palette.ribbon_unselected.background).paint(separator);
+ let more_styled_text = style!(text_color, palette.ribbon_unselected.background)
+ .bold()
+ .paint(more_text);
+ let right_separator = style!(palette.ribbon_unselected.background, sep_color).paint(separator);
let more_styled_text =
ANSIStrings(&[left_separator, more_styled_text, right_separator]).to_string();
LinePart {
@@ -142,7 +144,7 @@ fn left_more_message(
fn right_more_message(
tab_count_to_the_right: usize,
- palette: Palette,
+ palette: Styling,
separator: &str,
tab_index: usize,
) -> LinePart {
@@ -156,13 +158,15 @@ fn right_more_message(
};
// chars length plus separator length on both sides
let more_text_len = more_text.width() + 2 * separator.width();
- let (text_color, sep_color) = match palette.theme_hue {
- ThemeHue::Dark => (palette.white, palette.black),
- ThemeHue::Light => (palette.black, palette.white),
- };
- let left_separator = style!(sep_color, palette.orange).paint(separator);
- let more_styled_text = style!(text_color, palette.orange).bold().paint(more_text);
- let right_separator = style!(palette.orange, sep_color).paint(separator);
+ let (text_color, sep_color) = (
+ palette.ribbon_unselected.base,
+ palette.text_unselected.background,
+ );
+ let left_separator = style!(sep_color, palette.ribbon_unselected.background).paint(separator);
+ let more_styled_text = style!(text_color, palette.ribbon_unselected.background)
+ .bold()
+ .paint(more_text);
+ let right_separator = style!(palette.ribbon_unselected.background, sep_color).paint(separator);
let more_styled_text =
ANSIStrings(&[left_separator, more_styled_text, right_separator]).to_string();
LinePart {
@@ -172,18 +176,12 @@ fn right_more_message(
}
}
-fn tab_line_prefix(session_name: Option<&str>, palette: Palette, cols: usize) -> Vec<LinePart> {
+fn tab_line_prefix(session_name: Option<&str>, palette: Styling, cols: usize) -> Vec<LinePart> {
let prefix_text = " Zellij ".to_string();
let prefix_text_len = prefix_text.chars().count();
- 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 text_color = palette.text_unselected.base;
+ let bg_color = palette.text_unselected.background;
let prefix_styled_text = style!(text_color, bg_color).bold().paint(prefix_text);
let mut parts = vec![LinePart {
part: prefix_styled_text.to_string(),
@@ -193,10 +191,7 @@ 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 text_color = match palette.theme_hue {
- ThemeHue::Dark => palette.white,
- ThemeHue::Light => palette.black,
- };
+ let text_color = palette.text_unselected.base;
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 {
@@ -222,7 +217,7 @@ pub fn tab_line(
mut all_tabs: Vec<LinePart>,
active_tab_index: usize,
cols: usize,
- palette: Palette,
+ palette: Styling,
capabilities: PluginCapabilities,
hide_session_name: bool,
tab_info: Option<&TabInfo>,
@@ -290,7 +285,14 @@ pub fn tab_line(
let mut padding = String::new();
let mut padding_len = 0;
for _ in 0..remaining_space {
- padding.push_str(" ");
+ padding.push_str(
+ &style!(
+ palette.text_unselected.background,
+ palette.text_unselected.background
+ )
+ .paint(" ")
+ .to_string(),
+ );
padding_len += 1;
}
swap_layout_indicator.part = format!("{}{}", padding, swap_layout_indicator.part);
diff --git a/default-plugins/tab-bar/src/main.rs b/default-plugins/tab-bar/src/main.rs
index f38c245b..c8419715 100644
--- a/default-plugins/tab-bar/src/main.rs
+++ b/default-plugins/tab-bar/src/main.rs
@@ -125,10 +125,7 @@ impl ZellijPlugin for State {
all_tabs.push(tab);
}
- 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;
self.tab_line = tab_line(
self.mode_info.session_name.as_deref(),
diff --git a/default-plugins/tab-bar/src/tab.rs b/default-plugins/tab-bar/src/tab.rs
index 0c66d25a..312db5a4 100644
--- a/default-plugins/tab-bar/src/tab.rs
+++ b/default-plugins/tab-bar/src/tab.rs
@@ -4,12 +4,15 @@ use unicode_width::UnicodeWidthStr;
use zellij_tile::prelude::*;
use zellij_tile_utils::style;
-fn cursors(focused_clients: &[ClientId], palette: Palette) -> (Vec<ANSIString>, usize) {
+fn cursors(
+ focused_clients: &[ClientId],
+ multiplayer_colors: MultiplayerColors,
+) -> (Vec<ANSIString>, usize) {
// cursor section, text length
let mut len = 0;
let mut cursors = vec![];
for client_id in focused_clients.iter() {
- if let Some(color) = client_id_to_colors(*client_id, palette) {
+ if let Some(color) = client_id_to_colors(*client_id, multiplayer_colors) {
cursors.push(style!(color.1, color.0).paint(" "));
len += 1;
}
@@ -21,36 +24,41 @@ pub fn render_tab(
text: String,
tab: &TabInfo,
is_alternate_tab: bool,
- palette: Palette,
+ palette: Styling,
separator: &str,
) -> LinePart {
let focused_clients = tab.other_focused_clients.as_slice();
let separator_width = separator.width();
- let alternate_tab_color = match palette.theme_hue {
- // TODO: only do this if we don't have the arrow capabilities
- ThemeHue::Dark => palette.white,
- ThemeHue::Light => palette.black,
+
+ let alternate_tab_color = if is_alternate_tab {
+ palette.ribbon_unselected.emphasis_1
+ } else {
+ palette.ribbon_unselected.background
};
let background_color = if tab.active {
- palette.green
+ palette.ribbon_selected.background
} else if is_alternate_tab {
alternate_tab_color
} else {
- palette.fg
+ palette.ribbon_unselected.background
};
- let foreground_color = match palette.theme_hue {
- ThemeHue::Dark => palette.black,
- ThemeHue::Light => palette.white,
+ let foreground_color = if tab.active {
+ palette.ribbon_selected.base
+ } else {
+ palette.ribbon_unselected.base
};
- let left_separator = style!(foreground_color, background_color).paint(separator);
+
+ let separator_fill_color = palette.text_unselected.background;
+ let left_separator = style!(separator_fill_color, background_color).paint(separator);
let mut tab_text_len = text.width() + (separator_width * 2) + 2; // +2 for padding
let tab_styled_text = style!(foreground_color, background_color)
.bold()
.paint(format!(" {} ", text));
- let right_separator = style!(background_color, foreground_color).paint(separator);
+ let right_separator = style!(background_color, separator_fill_color).paint(separator);
let tab_styled_text = if !focused_clients.is_empty() {
- let (cursor_section, extra_length) = cursors(focused_clients, palette);
+ let (cursor_section, extra_length) =
+ cursors(focused_clients, palette.multiplayer_user_colors);
tab_text_len += extra_length + 2; // 2 for cursor_beginning and cursor_end
let mut s = String::new();
let cursor_beginning = style!(foreground_color, background_color)
@@ -84,7 +92,7 @@ pub fn tab_style(
mut tabname: String,
tab: &TabInfo,
mut is_alternate_tab: bool,
- palette: Palette,
+ palette: Styling,
capabilities: PluginCapabilities,
) -> LinePart {
let separator = tab_separator(capabilities);