diff options
author | Aram Drevekenin <aram@poor.dev> | 2021-05-04 16:06:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-04 16:06:55 +0200 |
commit | 1f88b342e2a381b958da4bebd852b73e42db1a8c (patch) | |
tree | 0edaf24bdfbe85c0f51a71ecf26a29d626d9e25d | |
parent | f2f20f676fbcc408feac75d92d80d221a43b433e (diff) |
fix(colors): stabilize colors (#453)
* fix(colors): stabilize colors
* style(fmt): rustfmt
-rw-r--r-- | Cargo.lock | 28 | ||||
-rw-r--r-- | Cargo.toml | 1 | ||||
-rw-r--r-- | default-plugins/status-bar/src/first_line.rs | 2 | ||||
-rw-r--r-- | default-plugins/status-bar/src/main.rs | 25 | ||||
-rw-r--r-- | default-plugins/status-bar/src/second_line.rs | 188 | ||||
-rw-r--r-- | default-plugins/tab-bar/src/line.rs | 14 | ||||
-rw-r--r-- | default-plugins/tab-bar/src/main.rs | 15 | ||||
-rw-r--r-- | default-plugins/tab-bar/src/tab.rs | 8 | ||||
-rw-r--r-- | src/client/boundaries.rs | 30 | ||||
-rw-r--r-- | src/common/os_input_output.rs | 49 | ||||
-rw-r--r-- | src/common/utils/shared.rs | 62 | ||||
-rw-r--r-- | src/tests/fakes.rs | 38 | ||||
-rw-r--r-- | zellij-tile-extra/src/lib.rs | 14 | ||||
-rw-r--r-- | zellij-tile/src/data.rs | 33 |
14 files changed, 206 insertions, 301 deletions
diff --git a/Cargo.lock b/Cargo.lock index cf2d94fc7..ac4a40a53 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1113,12 +1113,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] -name = "pkg-config" -version = "0.3.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" - -[[package]] name = "polling" version = "2.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2188,27 +2182,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" [[package]] -name = "x11" -version = "2.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ecd092546cb16f25783a5451538e73afc8d32e242648d54f4ae5459ba1e773" -dependencies = [ - "libc", - "pkg-config", -] - -[[package]] -name = "xrdb" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc2dd91a21c92e87678e22f95956a03bfd314ce3232f39dbedd49dddb50f0c6d" -dependencies = [ - "libc", - "scopeguard", - "x11", -] - -[[package]] name = "yaml-rust" version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2249,7 +2222,6 @@ dependencies = [ "vte 0.8.0", "wasmer", "wasmer-wasi", - "xrdb", "zellij-tile", "zellij-tile-extra", ] diff --git a/Cargo.toml b/Cargo.toml index a1f260cc9..b9375f594 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,7 +36,6 @@ lazy_static = "1.4.0" wasmer = "1.0.0" wasmer-wasi = "1.0.0" interprocess = "1.0.1" -xrdb = "0.1.1" colors-transform = "0.2.5" zellij-tile = { path = "zellij-tile/", version = "1.1.0" } zellij-tile-extra = { path = "zellij-tile-extra/", version="1.0.0" } diff --git a/default-plugins/status-bar/src/first_line.rs b/default-plugins/status-bar/src/first_line.rs index 77cb4dfc5..f679e8637 100644 --- a/default-plugins/status-bar/src/first_line.rs +++ b/default-plugins/status-bar/src/first_line.rs @@ -232,7 +232,7 @@ fn key_indicators(max_len: usize, keys: &[CtrlKeyShortcut], palette: ColoredElem } pub fn superkey(palette: ColoredElements) -> LinePart { - let prefix_text = " Ctrl + "; + let prefix_text = " Ctrl +"; let prefix = palette.superkey_prefix.paint(prefix_text); let suffix_separator = palette.superkey_suffix_separator.paint(ARROW_SEPARATOR); LinePart { diff --git a/default-plugins/status-bar/src/main.rs b/default-plugins/status-bar/src/main.rs index 93898cea3..2613ba79a 100644 --- a/default-plugins/status-bar/src/main.rs +++ b/default-plugins/status-bar/src/main.rs @@ -80,18 +80,18 @@ fn color_elements(palette: Palette) -> ColoredElements { selected_styled_text: style!(palette.black, palette.green).bold(), selected_suffix_separator: style!(palette.green, palette.bg).bold(), unselected_prefix_separator: style!(palette.bg, palette.fg), - unselected_char_left_separator: style!(palette.bg, palette.fg).bold(), + unselected_char_left_separator: style!(palette.black, palette.fg).bold(), unselected_char_shortcut: style!(palette.red, palette.fg).bold(), - unselected_char_right_separator: style!(palette.bg, palette.fg).bold(), + unselected_char_right_separator: style!(palette.black, palette.fg).bold(), unselected_styled_text: style!(palette.black, palette.fg).bold(), unselected_suffix_separator: style!(palette.fg, palette.bg), disabled_prefix_separator: style!(palette.bg, palette.fg), disabled_styled_text: style!(palette.bg, palette.fg).dimmed(), disabled_suffix_separator: style!(palette.fg, palette.bg), - selected_single_letter_prefix_separator: style!(palette.fg, palette.green), + selected_single_letter_prefix_separator: style!(palette.bg, palette.green), selected_single_letter_char_shortcut: style!(palette.red, palette.green).bold(), - selected_single_letter_suffix_separator: style!(palette.green, palette.fg), - unselected_single_letter_prefix_separator: style!(palette.fg, palette.bg), + selected_single_letter_suffix_separator: style!(palette.green, palette.bg), + unselected_single_letter_prefix_separator: style!(palette.bg, palette.fg), unselected_single_letter_char_shortcut: style!(palette.red, palette.fg).bold(), unselected_single_letter_suffix_separator: style!(palette.fg, palette.bg), superkey_prefix: style!(palette.white, palette.bg).bold(), @@ -149,13 +149,14 @@ impl ZellijPlugin for State { // [48;5;238m is gray background, [0K is so that it fills the rest of the line // [m is background reset, [0K is so that it clears the rest of the line - println!( - "{}\u{1b}[48;2;{};{};{}m\u{1b}[0K", - first_line, - self.mode_info.palette.bg.0, - self.mode_info.palette.bg.1, - self.mode_info.palette.bg.2 - ); + match self.mode_info.palette.bg { + PaletteColor::Rgb((r, g, b)) => { + println!("{}\u{1b}[48;2;{};{};{}m\u{1b}[0K", first_line, r, g, b); + } + PaletteColor::EightBit(color) => { + println!("{}\u{1b}[48;5;{}m\u{1b}[0K", first_line, color); + } + } println!("\u{1b}[m{}\u{1b}[0K", second_line); } } diff --git a/default-plugins/status-bar/src/second_line.rs b/default-plugins/status-bar/src/second_line.rs index 6982c4103..0861c4646 100644 --- a/default-plugins/status-bar/src/second_line.rs +++ b/default-plugins/status-bar/src/second_line.rs @@ -1,5 +1,8 @@ -// use colored::*; -use ansi_term::{ANSIStrings, Color::RGB, Style}; +use ansi_term::{ + ANSIStrings, + Color::{Fixed, RGB}, + Style, +}; use zellij_tile::prelude::*; use crate::{LinePart, MORE_MSG}; @@ -10,26 +13,22 @@ fn full_length_shortcut( description: &str, palette: Palette, ) -> LinePart { + 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 separator = if is_first_shortcut { " " } else { " / " }; - let separator = Style::new() - .fg(RGB(palette.fg.0, palette.fg.1, palette.fg.2)) - .paint(separator); + let separator = Style::new().fg(white_color).paint(separator); let shortcut_len = letter.chars().count() + 3; // 2 for <>'s around shortcut, 1 for the space - let shortcut_left_separator = Style::new() - .fg(RGB(palette.fg.0, palette.fg.1, palette.fg.2)) - .paint("<"); - let shortcut = Style::new() - .fg(RGB(palette.green.0, palette.green.1, palette.green.2)) - .bold() - .paint(letter); - let shortcut_right_separator = Style::new() - .fg(RGB(palette.fg.0, palette.fg.1, palette.fg.2)) - .paint("> "); + let shortcut_left_separator = Style::new().fg(white_color).paint("<"); + let shortcut = Style::new().fg(green_color).bold().paint(letter); + let shortcut_right_separator = Style::new().fg(white_color).paint("> "); let description_len = description.chars().count(); - let description = Style::new() - .fg(RGB(palette.fg.0, palette.fg.1, palette.fg.2)) - .bold() - .paint(description); + let description = Style::new().fg(white_color).bold().paint(description); let len = shortcut_len + description_len + separator.chars().count(); LinePart { part: format!( @@ -52,25 +51,24 @@ fn first_word_shortcut( description: &str, palette: Palette, ) -> LinePart { + 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 separator = if is_first_shortcut { " " } else { " / " }; - let separator = Style::new() - .fg(RGB(palette.fg.0, palette.fg.1, palette.fg.2)) - .paint(separator); + let separator = Style::new().fg(white_color).paint(separator); let shortcut_len = letter.chars().count() + 3; // 2 for <>'s around shortcut, 1 for the space - let shortcut_left_separator = Style::new() - .fg(RGB(palette.fg.0, palette.fg.1, palette.fg.2)) - .paint("<"); - let shortcut = Style::new() - .fg(RGB(palette.green.0, palette.green.1, palette.green.2)) - .bold() - .paint(letter); - let shortcut_right_separator = Style::new() - .fg(RGB(palette.fg.0, palette.fg.1, palette.fg.2)) - .paint("> "); + let shortcut_left_separator = Style::new().fg(white_color).paint("<"); + let shortcut = Style::new().fg(green_color).bold().paint(letter); + let shortcut_right_separator = Style::new().fg(white_color).paint("> "); let description_first_word = description.split(' ').next().unwrap_or(""); let description_first_word_length = description_first_word.chars().count(); let description_first_word = Style::new() - .fg(RGB(palette.fg.0, palette.fg.1, palette.fg.2)) + .fg(white_color) .bold() .paint(description_first_word); let len = shortcut_len + description_first_word_length + separator.chars().count(); @@ -111,34 +109,30 @@ fn quicknav_full(palette: Palette) -> LinePart { + text_fifth_part.chars().count() + hjkl_navigation.chars().count() + text_sixths_part.chars().count(); + 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), + }; 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(orange_color).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(green_color).bold().paint(new_pane_shortcut), text_third_part, - Style::new() - .fg(RGB(palette.orange.0, palette.orange.1, palette.orange.2)) - .bold() - .paint(second_alt), + Style::new().fg(orange_color).bold().paint(second_alt), text_fourth_part, Style::new() - .fg(RGB(palette.green.0, palette.green.1, palette.green.2)) + .fg(green_color) .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(green_color).bold().paint(hjkl_navigation), text_sixths_part, ), len, @@ -168,34 +162,30 @@ fn quicknav_medium(palette: Palette) -> LinePart { + text_fifth_part.chars().count() + hjkl_navigation.chars().count() + text_sixths_part.chars().count(); + 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), + }; 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(orange_color).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(green_color).bold().paint(new_pane_shortcut), text_third_part, - Style::new() - .fg(RGB(palette.orange.0, palette.orange.1, palette.orange.2)) - .bold() - .paint(second_alt), + Style::new().fg(orange_color).bold().paint(second_alt), text_fourth_part, Style::new() - .fg(RGB(palette.green.0, palette.green.1, palette.green.2)) + .fg(green_color) .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(green_color).bold().paint(hjkl_navigation), text_sixths_part, ), len, @@ -219,29 +209,28 @@ fn quicknav_short(palette: Palette) -> LinePart { + brackets_navigation.chars().count() + text_fifth_part.chars().count() + hjkl_navigation.chars().count(); + 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), + }; 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(orange_color).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(green_color).bold().paint(new_pane_shortcut), text_third_part, Style::new() - .fg(RGB(palette.green.0, palette.green.1, palette.green.2)) + .fg(green_color) .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(green_color).bold().paint(hjkl_navigation), ), len, } @@ -250,10 +239,11 @@ fn quicknav_short(palette: Palette) -> LinePart { fn locked_interface_indication(palette: Palette) -> LinePart { let locked_text = " -- INTERFACE LOCKED -- "; let locked_text_len = locked_text.chars().count(); - let locked_styled_text = Style::new() - .fg(RGB(palette.fg.0, palette.fg.1, palette.fg.2)) - .bold() - .paint(locked_text); + let white_color = match palette.white { + PaletteColor::Rgb((r, g, b)) => RGB(r, g, b), + PaletteColor::EightBit(color) => Fixed(color), + }; + let locked_styled_text = Style::new().fg(white_color).bold().paint(locked_text); LinePart { part: format!("{}", locked_styled_text), len: locked_text_len, @@ -264,25 +254,21 @@ fn select_pane_shortcut(is_first_shortcut: bool, palette: Palette) -> LinePart { let shortcut = "ENTER"; let description = "Select pane"; let separator = if is_first_shortcut { " " } else { " / " }; - let separator = Style::new() - .fg(RGB(palette.fg.0, palette.fg.1, palette.fg.2)) - .paint(separator); + 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), + }; + let separator = Style::new().fg(white_color).paint(separator); let shortcut_len = shortcut.chars().count() + 3; // 2 for <>'s around shortcut, 1 for the space - let shortcut_left_separator = Style::new() - .fg(RGB(palette.fg.0, palette.fg.1, palette.fg.2)) - .paint("<"); - let shortcut = Style::new() - .fg(RGB(palette.orange.0, palette.orange.1, palette.orange.2)) - .bold() - .paint(shortcut); - let shortcut_right_separator = Style::new() - .fg(RGB(palette.fg.0, palette.fg.1, palette.fg.2)) - .paint("> "); + let shortcut_left_separator = Style::new().fg(white_color).paint("<"); + let shortcut = Style::new().fg(orange_color).bold().paint(shortcut); + let shortcut_right_separator = Style::new().fg(white_color).paint("> "); let description_len = description.chars().count(); - let description = Style::new() - .fg(RGB(palette.fg.0, palette.fg.1, palette.fg.2)) - .bold() - .paint(description); + let description = Style::new().fg(white_color).bold().paint(description); let len = shortcut_len + description_len + separator.chars().count(); LinePart { part: format!( diff --git a/default-plugins/tab-bar/src/line.rs b/default-plugins/tab-bar/src/line.rs index 98ad51668..cd8346557 100644 --- a/default-plugins/tab-bar/src/line.rs +++ b/default-plugins/tab-bar/src/line.rs @@ -62,8 +62,10 @@ 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!(palette.fg, palette.orange).paint(ARROW_SEPARATOR); - let more_styled_text = style!(palette.fg, palette.orange).bold().paint(more_text); + let left_separator = style!(palette.bg, palette.orange).paint(ARROW_SEPARATOR); + let more_styled_text = style!(palette.black, palette.orange) + .bold() + .paint(more_text); let right_separator = style!(palette.orange, palette.bg).paint(ARROW_SEPARATOR); let more_styled_text = format!( "{}", @@ -88,8 +90,10 @@ 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!(palette.fg, palette.orange).paint(ARROW_SEPARATOR); - let more_styled_text = style!(palette.fg, palette.orange).bold().paint(more_text); + let left_separator = style!(palette.bg, palette.orange).paint(ARROW_SEPARATOR); + let more_styled_text = style!(palette.black, palette.orange) + .bold() + .paint(more_text); let right_separator = style!(palette.orange, palette.bg).paint(ARROW_SEPARATOR); let more_styled_text = format!( "{}", @@ -137,7 +141,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!(palette.fg, palette.bg).bold().paint(prefix_text); + let prefix_styled_text = style!(palette.white, palette.bg).bold().paint(prefix_text); LinePart { part: format!("{}", prefix_styled_text), len: prefix_text_len, diff --git a/default-plugins/tab-bar/src/main.rs b/default-plugins/tab-bar/src/main.rs index 1c6d584e3..c62770137 100644 --- a/default-plugins/tab-bar/src/main.rs +++ b/default-plugins/tab-bar/src/main.rs @@ -68,12 +68,13 @@ impl ZellijPlugin for State { for bar_part in tab_line { s = format!("{}{}", s, bar_part.part); } - println!( - "{}\u{1b}[48;2;{};{};{}m\u{1b}[0K", - s, - self.mode_info.palette.bg.0, - self.mode_info.palette.bg.1, - self.mode_info.palette.bg.2 - ); + match self.mode_info.palette.bg { + PaletteColor::Rgb((r, g, b)) => { + println!("{}\u{1b}[48;2;{};{};{}m\u{1b}[0K", s, r, g, b); + } + PaletteColor::EightBit(color) => { + println!("{}\u{1b}[48;5;{}m\u{1b}[0K", s, color); + } + } } } diff --git a/default-plugins/tab-bar/src/tab.rs b/default-plugins/tab-bar/src/tab.rs index ab110634a..b89ccb7b7 100644 --- a/default-plugins/tab-bar/src/tab.rs +++ b/default-plugins/tab-bar/src/tab.rs @@ -6,7 +6,7 @@ use zellij_tile_extra::*; pub fn active_tab(text: String, palette: Palette) -> LinePart { 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!(palette.bg, palette.green) + let tab_styled_text = style!(palette.black, palette.green) .bold() .paint(format!(" {} ", text)); let right_separator = style!(palette.green, palette.bg).paint(ARROW_SEPARATOR); @@ -21,12 +21,12 @@ pub fn active_tab(text: String, palette: Palette) -> LinePart { } pub fn non_active_tab(text: String, palette: Palette) -> LinePart { - let left_separator = style!(palette.bg, palette.bg).paint(ARROW_SEPARATOR); + let left_separator = style!(palette.bg, palette.fg).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!(palette.fg, palette.bg) + let tab_styled_text = style!(palette.black, palette.fg) .bold() .paint(format!(" {} ", text)); - let right_separator = style!(palette.bg, palette.bg).paint(ARROW_SEPARATOR); + let right_separator = style!(palette.fg, palette.bg).paint(ARROW_SEPARATOR); let tab_styled_text = format!( "{}", ANSIStrings(&[left_separator, tab_styled_text, right_separator,]) diff --git a/src/client/boundaries.rs b/src/client/boundaries.rs index 7a85812f0..86fb37fcb 100644 --- a/src/client/boundaries.rs +++ b/src/client/boundaries.rs @@ -1,8 +1,8 @@ use crate::tab::Pane; use crate::utils::shared::colors; -use ansi_term::Colour::RGB; +use ansi_term::Colour::{Fixed, RGB}; use std::collections::HashMap; -use zellij_tile::data::{InputMode, Palette}; +use zellij_tile::data::{InputMode, Palette, PaletteColor}; use std::fmt::{Display, Error, Formatter}; pub mod boundary_type { @@ -19,20 +19,13 @@ pub mod boundary_type { pub const CROSS: &str = "┼"; } -// pub mod colors { -// use ansi_term::Colour::{self, Fixed}; -// pub const GREEN: Colour = Fixed(154); -// pub const GRAY: Colour = Fixed(238); -// pub const ORANGE: Colour = Fixed(166); -// } - pub type BoundaryType = &'static str; // easy way to refer to boundary_type above #[derive(Clone, Copy, Debug)] pub struct BoundarySymbol { boundary_type: BoundaryType, invisible: bool, - color: Option<(u8, u8, u8)>, + color: Option<PaletteColor>, } impl BoundarySymbol { @@ -40,14 +33,14 @@ impl BoundarySymbol { BoundarySymbol { boundary_type, invisible: false, - color: Some(colors::GRAY), + color: Some(PaletteColor::EightBit(colors::GRAY)), } } pub fn invisible(mut self) -> Self { self.invisible = true; self } - pub fn color(&mut self, color: Option<(u8, u8, u8)>) -> Self { + pub fn color(&mut self, color: Option<PaletteColor>) -> Self { self.color = color; *self } @@ -58,11 +51,14 @@ impl Display for BoundarySymbol { match self.invisible { true => write!(f, " "), false => match self.color { |