use crate::output::CharacterChunk;
use crate::panes::{AnsiCode, CharacterStyles, TerminalCharacter, EMPTY_TERMINAL_CHARACTER};
use crate::ui::boundaries::boundary_type;
use crate::ClientId;
use zellij_utils::data::{client_id_to_colors, PaletteColor, Style};
use zellij_utils::errors::prelude::*;
use zellij_utils::pane_size::Viewport;
use unicode_width::{UnicodeWidthChar, UnicodeWidthStr};
fn foreground_color(characters: &str, color: Option<PaletteColor>) -> Vec<TerminalCharacter> {
let mut colored_string = Vec::with_capacity(characters.chars().count());
for character in characters.chars() {
let styles = match color {
Some(palette_color) => {
let mut styles = CharacterStyles::new();
styles.reset_all();
styles
.foreground(Some(AnsiCode::from(palette_color)))
.bold(Some(AnsiCode::On))
},
None => {
let mut styles = CharacterStyles::new();
styles.reset_all();
styles.bold(Some(AnsiCode::On))
},
};
let terminal_character = TerminalCharacter {
character,
styles,
width: character.width().unwrap_or(0),
};
colored_string.push(terminal_character);
}
colored_string
}
fn background_color(characters: &str, color: Option<PaletteColor>) -> Vec<TerminalCharacter> {
let mut colored_string = Vec::with_capacity(characters.chars().count());
for character in characters.chars() {
let styles = match color {
Some(palette_color) => {
let mut styles = CharacterStyles::new();
styles.reset_all();
styles
.background(Some(AnsiCode::from(palette_color)))
.bold(Some(AnsiCode::On))
},
None => {
let mut styles = CharacterStyles::new();
styles.reset_all();
styles
},
};
let terminal_character = TerminalCharacter