wip: tab bar coloring
This commit is contained in:
parent
c44de89350
commit
de72d3d2fb
8 changed files with 16 additions and 19 deletions
|
|
@ -3,15 +3,12 @@ mod second_line;
|
||||||
|
|
||||||
use ansi_term::{Color::RGB, Style};
|
use ansi_term::{Color::RGB, Style};
|
||||||
|
|
||||||
use std::{
|
use std::fmt::{Display, Error, Formatter};
|
||||||
fmt::{Display, Error, Formatter},
|
use zellij_tile::prelude::*;
|
||||||
};
|
|
||||||
use zellij_tile::{prelude::*};
|
|
||||||
|
|
||||||
use first_line::{ctrl_keys, superkey};
|
use first_line::{ctrl_keys, superkey};
|
||||||
use second_line::keybinds;
|
use second_line::keybinds;
|
||||||
|
|
||||||
|
|
||||||
pub mod colors {
|
pub mod colors {
|
||||||
use ansi_term::Colour::{self, Fixed};
|
use ansi_term::Colour::{self, Fixed};
|
||||||
pub const WHITE: Colour = Fixed(255);
|
pub const WHITE: Colour = Fixed(255);
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,12 @@ pub fn tab_line(
|
||||||
}
|
}
|
||||||
tab_line.append(&mut tabs_to_render);
|
tab_line.append(&mut tabs_to_render);
|
||||||
if !tabs_after_active.is_empty() {
|
if !tabs_after_active.is_empty() {
|
||||||
add_next_tabs_msg(&mut tabs_after_active, &mut tab_line, cols - prefix.len, palette);
|
add_next_tabs_msg(
|
||||||
|
&mut tabs_after_active,
|
||||||
|
&mut tab_line,
|
||||||
|
cols - prefix.len,
|
||||||
|
palette,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
tab_line.insert(0, prefix);
|
tab_line.insert(0, prefix);
|
||||||
tab_line
|
tab_line
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ impl ZellijPlugin for State {
|
||||||
|
|
||||||
fn update(&mut self, event: Event) {
|
fn update(&mut self, event: Event) {
|
||||||
match event {
|
match event {
|
||||||
Event::ModeUpdate(mode_info) => self.mode_info.mode = mode_info.mode,
|
Event::ModeUpdate(mode_info) => self.mode_info = mode_info,
|
||||||
Event::TabUpdate(tabs) => self.tabs = tabs,
|
Event::TabUpdate(tabs) => self.tabs = tabs,
|
||||||
_ => unimplemented!(), // FIXME: This should be unreachable, but this could be cleaner
|
_ => unimplemented!(), // FIXME: This should be unreachable, but this could be cleaner
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
use crate::colors::{BLACK, BRIGHT_GRAY, GRAY, GREEN};
|
|
||||||
use crate::{LinePart, ARROW_SEPARATOR};
|
use crate::{LinePart, ARROW_SEPARATOR};
|
||||||
use ansi_term::{ANSIStrings, Color::RGB, Style};
|
use ansi_term::{ANSIStrings, Color::RGB, Style};
|
||||||
use zellij_tile::data::Palette;
|
use zellij_tile::data::Palette;
|
||||||
|
|
||||||
pub fn active_tab(text: String, palette: Palette) -> LinePart {
|
pub fn active_tab(text: String, palette: Palette) -> LinePart {
|
||||||
let left_separator = Style::new()
|
let left_separator = Style::new()
|
||||||
.fg(RGB(palette.fg.0, palette.fg.1, palette.fg.2))
|
.fg(RGB(palette.bg.0, palette.bg.1, palette.bg.2))
|
||||||
.on(RGB(palette.green.0, palette.green.1, palette.green.2))
|
.on(RGB(palette.green.0, palette.green.1, palette.green.2))
|
||||||
.paint(ARROW_SEPARATOR);
|
.paint(ARROW_SEPARATOR);
|
||||||
let tab_text_len = text.chars().count() + 4; // 2 for left and right separators, 2 for the text padding
|
let tab_text_len = text.chars().count() + 4; // 2 for left and right separators, 2 for the text padding
|
||||||
|
|
@ -30,7 +29,7 @@ pub fn active_tab(text: String, palette: Palette) -> LinePart {
|
||||||
|
|
||||||
pub fn non_active_tab(text: String, palette: Palette) -> LinePart {
|
pub fn non_active_tab(text: String, palette: Palette) -> LinePart {
|
||||||
let left_separator = Style::new()
|
let left_separator = Style::new()
|
||||||
.fg(RGB(palette.fg.0, palette.fg.1, palette.fg.2))
|
.fg(RGB(palette.bg.0, palette.bg.1, palette.bg.2))
|
||||||
.on(RGB(palette.bg.0, palette.bg.1, palette.bg.2))
|
.on(RGB(palette.bg.0, palette.bg.1, palette.bg.2))
|
||||||
.paint(ARROW_SEPARATOR);
|
.paint(ARROW_SEPARATOR);
|
||||||
let tab_text_len = text.chars().count() + 4; // 2 for left and right separators, 2 for the padding
|
let tab_text_len = text.chars().count() + 4; // 2 for left and right separators, 2 for the padding
|
||||||
|
|
@ -40,7 +39,7 @@ pub fn non_active_tab(text: String, palette: Palette) -> LinePart {
|
||||||
.bold()
|
.bold()
|
||||||
.paint(format!(" {} ", text));
|
.paint(format!(" {} ", text));
|
||||||
let right_separator = Style::new()
|
let right_separator = Style::new()
|
||||||
.fg(RGB(palette.fg.0, palette.fg.1, palette.fg.2))
|
.fg(RGB(palette.bg.0, palette.bg.1, palette.bg.2))
|
||||||
.on(RGB(palette.bg.0, palette.bg.1, palette.bg.2))
|
.on(RGB(palette.bg.0, palette.bg.1, palette.bg.2))
|
||||||
.paint(ARROW_SEPARATOR);
|
.paint(ARROW_SEPARATOR);
|
||||||
let tab_styled_text = format!(
|
let tab_styled_text = format!(
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ use std::{
|
||||||
collections::{BTreeMap, HashSet},
|
collections::{BTreeMap, HashSet},
|
||||||
};
|
};
|
||||||
use std::{io::Write, sync::mpsc::channel};
|
use std::{io::Write, sync::mpsc::channel};
|
||||||
use zellij_tile::data::{colors, Event, InputMode, ModeInfo, Palette};
|
use zellij_tile::data::{Event, InputMode, ModeInfo, Palette};
|
||||||
|
|
||||||
const CURSOR_HEIGHT_WIDTH_RATIO: usize = 4; // this is not accurate and kind of a magic number, TODO: look into this
|
const CURSOR_HEIGHT_WIDTH_RATIO: usize = 4; // this is not accurate and kind of a magic number, TODO: look into this
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ use crate::common::input::config::Config;
|
||||||
use crate::layout::Layout;
|
use crate::layout::Layout;
|
||||||
use crate::panes::PaneId;
|
use crate::panes::PaneId;
|
||||||
use async_std::task_local;
|
use async_std::task_local;
|
||||||
use colors_transform::{Color, Rgb};
|
|
||||||
use command_is_executing::CommandIsExecuting;
|
use command_is_executing::CommandIsExecuting;
|
||||||
use directories_next::ProjectDirs;
|
use directories_next::ProjectDirs;
|
||||||
use errors::{
|
use errors::{
|
||||||
|
|
@ -45,10 +44,7 @@ use wasm_vm::PluginEnv;
|
||||||
use wasm_vm::{wasi_stdout, wasi_write_string, zellij_imports, PluginInstruction};
|
use wasm_vm::{wasi_stdout, wasi_write_string, zellij_imports, PluginInstruction};
|
||||||
use wasmer::{ChainableNamedResolver, Instance, Module, Store, Value};
|
use wasmer::{ChainableNamedResolver, Instance, Module, Store, Value};
|
||||||
use wasmer_wasi::{Pipe, WasiState};
|
use wasmer_wasi::{Pipe, WasiState};
|
||||||
use xrdb::Colors;
|
use zellij_tile::data::{EventType, InputMode, ModeInfo};
|
||||||
use zellij_tile::data::{EventType, InputMode, ModeInfo, Palette, Theme};
|
|
||||||
|
|
||||||
use self::utils::logging::debug_log_to_file;
|
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
pub enum ApiCommand {
|
pub enum ApiCommand {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ use strip_ansi_escapes::strip;
|
||||||
|
|
||||||
use colors_transform::{Color, Rgb};
|
use colors_transform::{Color, Rgb};
|
||||||
use xrdb::Colors;
|
use xrdb::Colors;
|
||||||
use zellij_tile::data::{Palette, Theme, PaletteSource};
|
use zellij_tile::data::{Palette, PaletteSource, Theme};
|
||||||
|
|
||||||
fn ansi_len(s: &str) -> usize {
|
fn ansi_len(s: &str) -> usize {
|
||||||
from_utf8(&strip(s.as_bytes()).unwrap())
|
from_utf8(&strip(s.as_bytes()).unwrap())
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ pub enum Theme {
|
||||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
|
||||||
pub enum PaletteSource {
|
pub enum PaletteSource {
|
||||||
Default,
|
Default,
|
||||||
Xresources
|
Xresources,
|
||||||
}
|
}
|
||||||
pub mod colors {
|
pub mod colors {
|
||||||
pub const WHITE: (u8, u8, u8) = (238, 238, 238);
|
pub const WHITE: (u8, u8, u8) = (238, 238, 238);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue