wip: I really don't want people to hate me
This commit is contained in:
parent
2e94ef51aa
commit
12388c9e86
3 changed files with 30 additions and 54 deletions
|
|
@ -1,8 +1,15 @@
|
|||
use crate::colors::{BLACK, GRAY, ORANGE, WHITE};
|
||||
use ansi_term::{ANSIStrings, Color::RGB, Style};
|
||||
|
||||
use crate::{LinePart, ARROW_SEPARATOR};
|
||||
use zellij_tile::data::Palette;
|
||||
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))
|
||||
};
|
||||
}
|
||||
|
||||
fn get_current_title_len(current_title: &[LinePart]) -> usize {
|
||||
current_title
|
||||
|
|
@ -62,13 +69,9 @@ fn left_more_message(tab_count_to_the_left: usize, palette: Palette) -> LinePart
|
|||
};
|
||||
// 238
|
||||
let more_text_len = more_text.chars().count() + 2; // 2 for the arrows
|
||||
let left_separator = Style::new().fg(GRAY).on(ORANGE).paint(ARROW_SEPARATOR);
|
||||
let more_styled_text = Style::new()
|
||||
.fg(RGB(palette.fg.0, palette.fg.1, palette.fg.2))
|
||||
.on(ORANGE)
|
||||
.bold()
|
||||
.paint(more_text);
|
||||
let right_separator = Style::new().fg(ORANGE).on(GRAY).paint(ARROW_SEPARATOR);
|
||||
let left_separator = style!(palette.fg, palette.orange).paint(ARROW_SEPARATOR);
|
||||
let more_styled_text = style!(palette.fg, palette.orange).bold().paint(more_text);
|
||||
let right_separator = style!(palette.orange, palette.bg).paint(ARROW_SEPARATOR);
|
||||
let more_styled_text = format!(
|
||||
"{}",
|
||||
ANSIStrings(&[left_separator, more_styled_text, right_separator,])
|
||||
|
|
@ -92,13 +95,9 @@ fn right_more_message(tab_count_to_the_right: usize, palette: Palette) -> LinePa
|
|||
" +many → ".to_string()
|
||||
};
|
||||
let more_text_len = more_text.chars().count() + 1; // 2 for the arrow
|
||||
let left_separator = Style::new().fg(GRAY).on(ORANGE).paint(ARROW_SEPARATOR);
|
||||
let more_styled_text = Style::new()
|
||||
.fg(RGB(palette.fg.0, palette.fg.1, palette.fg.2))
|
||||
.on(ORANGE)
|
||||
.bold()
|
||||
.paint(more_text);
|
||||
let right_separator = Style::new().fg(ORANGE).on(GRAY).paint(ARROW_SEPARATOR);
|
||||
let left_separator = style!(palette.fg, palette.orange).paint(ARROW_SEPARATOR);
|
||||
let more_styled_text = style!(palette.fg, palette.orange).bold().paint(more_text);
|
||||
let right_separator = style!(palette.orange, palette.bg).paint(ARROW_SEPARATOR);
|
||||
let more_styled_text = format!(
|
||||
"{}",
|
||||
ANSIStrings(&[left_separator, more_styled_text, right_separator,])
|
||||
|
|
@ -145,11 +144,7 @@ fn add_next_tabs_msg(
|
|||
fn tab_line_prefix(palette: Palette) -> LinePart {
|
||||
let prefix_text = " Zellij ".to_string();
|
||||
let prefix_text_len = prefix_text.chars().count();
|
||||
let prefix_styled_text = Style::new()
|
||||
.fg(RGB(palette.fg.0, palette.fg.1, palette.fg.2))
|
||||
.on(RGB(palette.bg.0, palette.bg.1, palette.bg.2))
|
||||
.bold()
|
||||
.paint(prefix_text);
|
||||
let prefix_styled_text = style!(palette.fg, palette.bg).bold().paint(prefix_text);
|
||||
LinePart {
|
||||
part: format!("{}", prefix_styled_text),
|
||||
len: prefix_text_len,
|
||||
|
|
|
|||
|
|
@ -20,17 +20,6 @@ struct State {
|
|||
|
||||
static ARROW_SEPARATOR: &str = "";
|
||||
|
||||
pub mod colors {
|
||||
use ansi_term::Colour::{self, Fixed};
|
||||
pub const WHITE: Colour = Fixed(255);
|
||||
pub const BLACK: Colour = Fixed(16);
|
||||
pub const GREEN: Colour = Fixed(154);
|
||||
pub const ORANGE: Colour = Fixed(166);
|
||||
pub const GRAY: Colour = Fixed(238);
|
||||
pub const BRIGHT_GRAY: Colour = Fixed(245);
|
||||
pub const RED: Colour = Fixed(88);
|
||||
}
|
||||
|
||||
register_plugin!(State);
|
||||
|
||||
impl ZellijPlugin for State {
|
||||
|
|
|
|||
|
|
@ -2,21 +2,21 @@ 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))
|
||||
};
|
||||
}
|
||||
|
||||
pub fn active_tab(text: String, palette: Palette) -> LinePart {
|
||||
let left_separator = Style::new()
|
||||
.fg(RGB(palette.bg.0, palette.bg.1, palette.bg.2))
|
||||
.on(RGB(palette.green.0, palette.green.1, palette.green.2))
|
||||
.paint(ARROW_SEPARATOR);
|
||||
let left_separator = style!(palette.bg, palette.green).paint(ARROW_SEPARATOR);
|
||||
let tab_text_len = text.chars().count() + 4; // 2 for left and right separators, 2 for the text padding
|
||||
let tab_styled_text = Style::new()
|
||||
.fg(RGB(palette.fg.0, palette.fg.1, palette.fg.2))
|
||||
.on(RGB(palette.green.0, palette.green.1, palette.green.2))
|
||||
let tab_styled_text = style!(palette.bg, palette.green)
|
||||
.bold()
|
||||
.paint(format!(" {} ", text));
|
||||
let right_separator = Style::new()
|
||||
.fg(RGB(palette.green.0, palette.green.1, palette.green.2))
|
||||
.on(RGB(palette.bg.0, palette.bg.1, palette.bg.2))
|
||||
.paint(ARROW_SEPARATOR);
|
||||
let right_separator = style!(palette.green, palette.bg).paint(ARROW_SEPARATOR);
|
||||
let tab_styled_text = format!(
|
||||
"{}",
|
||||
ANSIStrings(&[left_separator, tab_styled_text, right_separator,])
|
||||
|
|
@ -28,20 +28,12 @@ pub fn active_tab(text: String, palette: Palette) -> LinePart {
|
|||
}
|
||||
|
||||
pub fn non_active_tab(text: String, palette: Palette) -> LinePart {
|
||||
let left_separator = Style::new()
|
||||
.fg(RGB(palette.bg.0, palette.bg.1, palette.bg.2))
|
||||
.on(RGB(palette.bg.0, palette.bg.1, palette.bg.2))
|
||||
.paint(ARROW_SEPARATOR);
|
||||
let left_separator = style!(palette.bg, palette.bg).paint(ARROW_SEPARATOR);
|
||||
let tab_text_len = text.chars().count() + 4; // 2 for left and right separators, 2 for the padding
|
||||
let tab_styled_text = Style::new()
|
||||
.fg(RGB(palette.fg.0, palette.fg.1, palette.fg.2))
|
||||
.on(RGB(palette.bg.0, palette.bg.1, palette.bg.2))
|
||||
let tab_styled_text = style!(palette.fg, palette.bg)
|
||||
.bold()
|
||||
.paint(format!(" {} ", text));
|
||||
let right_separator = Style::new()
|
||||
.fg(RGB(palette.bg.0, palette.bg.1, palette.bg.2))
|
||||
.on(RGB(palette.bg.0, palette.bg.1, palette.bg.2))
|
||||
.paint(ARROW_SEPARATOR);
|
||||
let right_separator = style!(palette.bg, palette.bg).paint(ARROW_SEPARATOR);
|
||||
let tab_styled_text = format!(
|
||||
"{}",
|
||||
ANSIStrings(&[left_separator, tab_styled_text, right_separator,])
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue