diff options
author | denis <denismaximov98@gmail.com> | 2021-05-01 14:44:43 +0300 |
---|---|---|
committer | denis <denismaximov98@gmail.com> | 2021-05-01 14:44:43 +0300 |
commit | f85822972ad6ed19f94bc1b30a7120bcd4b091e0 (patch) | |
tree | 7b65e9da4d56a9c87ab5829a6389ac28133cf940 /default-plugins | |
parent | eabecde90b1617ce4c29be9d5af3f52ccb67e45f (diff) |
chore: cleanup, fix: the tests finally pass
Diffstat (limited to 'default-plugins')
-rw-r--r-- | default-plugins/status-bar/src/main.rs | 13 | ||||
-rw-r--r-- | default-plugins/status-bar/src/second_line.rs | 20 | ||||
-rw-r--r-- | default-plugins/tab-bar/src/line.rs | 12 | ||||
-rw-r--r-- | default-plugins/tab-bar/src/main.rs | 2 | ||||
-rw-r--r-- | default-plugins/tab-bar/src/tab.rs | 12 |
5 files changed, 21 insertions, 38 deletions
diff --git a/default-plugins/status-bar/src/main.rs b/default-plugins/status-bar/src/main.rs index efa193985..4914efdb0 100644 --- a/default-plugins/status-bar/src/main.rs +++ b/default-plugins/status-bar/src/main.rs @@ -119,19 +119,6 @@ impl ColoredElements { } } -macro_rules! rgb { - ($a:expr) => { - RGB($a.0, $a.1, $a.2) - }; -} -macro_rules! style { - ($a:expr, $b:expr) => { - Style::new() - .fg(RGB($a.0, $a.1, $a.2)) - .on(RGB($b.0, $b.1, $b.2)) - }; -} - // I really hate this, but I can't come up with a good solution for this, // we need different colors from palette for the default theme // plus here we can add new sources in the future, like Theme diff --git a/default-plugins/status-bar/src/second_line.rs b/default-plugins/status-bar/src/second_line.rs index 73c4d7650..6982c4103 100644 --- a/default-plugins/status-bar/src/second_line.rs +++ b/default-plugins/status-bar/src/second_line.rs @@ -223,13 +223,25 @@ fn quicknav_short(palette: Palette) -> LinePart { part: format!( "{}{}{}{}{}{}{}{}", text_first_part, - Style::new().fg(RGB(palette.orange.0, palette.orange.1, palette.orange.2)).bold().paint(alt), + Style::new() + .fg(RGB(palette.orange.0, palette.orange.1, palette.orange.2)) + .bold() + .paint(alt), text_second_part, - Style::new().fg(RGB(palette.green.0, palette.green.1, palette.green.2)).bold().paint(new_pane_shortcut), + Style::new() + .fg(RGB(palette.green.0, palette.green.1, palette.green.2)) + .bold() + .paint(new_pane_shortcut), text_third_part, - Style::new().fg(RGB(palette.green.0, palette.green.1, palette.green.2)).bold().paint(brackets_navigation), + Style::new() + .fg(RGB(palette.green.0, palette.green.1, palette.green.2)) + .bold() + .paint(brackets_navigation), text_fifth_part, - Style::new().fg(RGB(palette.green.0, palette.green.1, palette.green.2)).bold().paint(hjkl_navigation), + Style::new() + .fg(RGB(palette.green.0, palette.green.1, palette.green.2)) + .bold() + .paint(hjkl_navigation), ), len, } diff --git a/default-plugins/tab-bar/src/line.rs b/default-plugins/tab-bar/src/line.rs index 5976f12f5..ae287d2e8 100644 --- a/default-plugins/tab-bar/src/line.rs +++ b/default-plugins/tab-bar/src/line.rs @@ -1,15 +1,7 @@ -use ansi_term::{ANSIStrings, Color::RGB, Style}; +use ansi_term::ANSIStrings; use crate::{LinePart, ARROW_SEPARATOR}; -use zellij_tile::data::{colors::*, Palette}; - -macro_rules! style { - ($a:expr, $b:expr) => { - Style::new() - .fg(RGB($a.0, $a.1, $a.2)) - .on(RGB($b.0, $b.1, $b.2)) - }; -} +use zellij_tile::prelude::*; fn get_current_title_len(current_title: &[LinePart]) -> usize { current_title diff --git a/default-plugins/tab-bar/src/main.rs b/default-plugins/tab-bar/src/main.rs index 7c6a22209..1c6d584e3 100644 --- a/default-plugins/tab-bar/src/main.rs +++ b/default-plugins/tab-bar/src/main.rs @@ -59,7 +59,7 @@ impl ZellijPlugin for State { t.active, t.position, t.is_sync_panes_active, - self.mode_info.palette + self.mode_info.palette, ); all_tabs.push(tab); } diff --git a/default-plugins/tab-bar/src/tab.rs b/default-plugins/tab-bar/src/tab.rs index 3e3408103..27b4ad94e 100644 --- a/default-plugins/tab-bar/src/tab.rs +++ b/default-plugins/tab-bar/src/tab.rs @@ -1,14 +1,6 @@ use crate::{LinePart, ARROW_SEPARATOR}; use ansi_term::{ANSIStrings, Color::RGB, Style}; -use zellij_tile::data::Palette; - -macro_rules! style { - ($a:expr, $b:expr) => { - Style::new() - .fg(RGB($a.0, $a.1, $a.2)) - .on(RGB($b.0, $b.1, $b.2)) - }; -} +use zellij_tile::prelude::*; pub fn active_tab(text: String, palette: Palette) -> LinePart { let left_separator = style!(palette.bg, palette.green).paint(ARROW_SEPARATOR); @@ -49,7 +41,7 @@ pub fn tab_style( is_active_tab: bool, position: usize, is_sync_panes_active: bool, - palette: Palette + palette: Palette, ) -> LinePart { let mut tab_text = if text.is_empty() { format!("Tab #{}", position + 1) |