Stop hardcoding certain component colors

`Color::Byte` references were before themes were introduced in the code
base. Their presence is a bug and they should all be replaced by theme
values.

Closes #124

Stop hardcoding certain component colors #124
https://git.meli.delivery/meli/meli/issues/124
pull/144/head
Manos Pitsidianakis 2022-03-22 21:00:21 +02:00
parent 5823178cc2
commit 2eb22a290a
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
14 changed files with 139 additions and 176 deletions

View File

@ -171,8 +171,20 @@ In this mode, cursor locations (i.e., currently selected entries/items) will use
.It
theme_default
.It
error_message
.It
email_header
.It
highlight
.It
status.bar
.It
status.command_bar
.It
status.history
.It
status.history.hints
.It
status.notification
.It
tab.focused

View File

@ -80,7 +80,7 @@ impl ContactManager {
let (x, _) = write_string_to_grid(
"Last edited: ",
&mut self.content,
Color::Byte(250),
self.theme_default.fg,
self.theme_default.bg,
self.theme_default.attrs,
((0, 0), (width - 1, 0)),
@ -89,7 +89,7 @@ impl ContactManager {
let (x, y) = write_string_to_grid(
&self.card.last_edited(),
&mut self.content,
Color::Byte(250),
self.theme_default.fg,
self.theme_default.bg,
self.theme_default.attrs,
((x, 0), (width - 1, 0)),
@ -102,7 +102,7 @@ impl ContactManager {
write_string_to_grid(
"This contact's origin is external and cannot be edited within meli.",
&mut self.content,
Color::Byte(250),
self.theme_default.fg,
self.theme_default.bg,
self.theme_default.attrs,
((x, y), (width - 1, y)),

View File

@ -49,6 +49,7 @@ pub struct ContactList {
data_columns: DataColumns,
initialized: bool,
theme_default: ThemeAttribute,
highlight_theme: ThemeAttribute,
id_positions: Vec<CardId>,
@ -95,6 +96,7 @@ impl ContactList {
mode: ViewMode::List,
data_columns: DataColumns::default(),
theme_default: crate::conf::value(context, "theme_default"),
highlight_theme: crate::conf::value(context, "highlight"),
initialized: false,
dirty: true,
movement: None,
@ -222,7 +224,7 @@ impl ContactList {
/* Reset previously highlighted line */
let fg_color = self.theme_default.fg;
let bg_color = if idx == self.new_cursor_pos {
Color::Byte(246)
self.highlight_theme.bg
} else {
self.theme_default.bg
};

View File

@ -586,7 +586,7 @@ To: {}
grid,
theme_default.fg,
if self.cursor == Cursor::Sign {
Color::Byte(237)
crate::conf::value(context, "highlight").bg
} else {
theme_default.bg
},
@ -600,7 +600,7 @@ To: {}
grid,
theme_default.fg,
if self.cursor == Cursor::Sign {
Color::Byte(237)
crate::conf::value(context, "highlight").bg
} else {
theme_default.bg
},
@ -636,7 +636,7 @@ To: {}
grid,
theme_default.fg,
if self.cursor == Cursor::Encrypt {
Color::Byte(237)
crate::conf::value(context, "highlight").bg
} else {
theme_default.bg
},
@ -650,7 +650,7 @@ To: {}
grid,
theme_default.fg,
if self.cursor == Cursor::Encrypt {
Color::Byte(237)
crate::conf::value(context, "highlight").bg
} else {
theme_default.bg
},
@ -665,7 +665,7 @@ To: {}
grid,
theme_default.fg,
if self.cursor == Cursor::Attachments {
Color::Byte(237)
crate::conf::value(context, "highlight").bg
} else {
theme_default.bg
},
@ -679,7 +679,7 @@ To: {}
grid,
theme_default.fg,
if self.cursor == Cursor::Attachments {
Color::Byte(237)
crate::conf::value(context, "highlight").bg
} else {
theme_default.bg
},
@ -809,9 +809,9 @@ impl Component for Composer {
"COMPOSING MESSAGE"
},
grid,
Color::Byte(189),
Color::Byte(167),
Attr::DEFAULT,
crate::conf::value(context, "highlight").fg,
crate::conf::value(context, "highlight").bg,
crate::conf::value(context, "highlight").attrs,
(
pos_dec(upper_left!(header_area), (0, 1)),
bottom_right!(header_area),
@ -825,8 +825,8 @@ impl Component for Composer {
set_x(pos_dec(upper_left!(header_area), (0, 1)), x),
set_y(bottom_right!(header_area), y),
),
Color::Byte(189),
Color::Byte(167),
crate::conf::value(context, "highlight").fg,
crate::conf::value(context, "highlight").bg,
);
clear_area(
grid,
@ -943,7 +943,7 @@ impl Component for Composer {
),
),
theme_default.fg,
Color::Byte(237),
crate::conf::value(context, "highlight").bg,
);
}
Cursor::Sign | Cursor::Encrypt | Cursor::Attachments => {}

View File

@ -131,7 +131,7 @@ impl Component for EditAttachmentsRefMut<'_, '_> {
for (i, a) in self.draft.attachments().iter().enumerate() {
let bg = if let EditAttachmentCursor::AttachmentNo(u) = self.inner.cursor {
if u == i {
Color::Byte(237)
crate::conf::value(context, "highlight").bg
} else {
theme_default.bg
}

View File

@ -1918,7 +1918,7 @@ impl Listing {
write_string_to_grid(
"offline",
&mut self.menu_content,
Color::Byte(243),
crate::conf::value(context, "error_message").fg,
account_attrs.bg,
account_attrs.attrs,
(pos_inc(upper_left, (0, 1)), bottom_right),

View File

@ -116,9 +116,9 @@ impl Component for OfflineListing {
let (x, _) = write_string_to_grid(
"offline: ",
grid,
Color::Byte(243),
theme_default.bg,
theme_default.attrs,
conf::value(context, "error_message").fg,
conf::value(context, "error_message").bg,
conf::value(context, "error_message").attrs,
area,
None,
);
@ -135,9 +135,9 @@ impl Component for OfflineListing {
let (_, mut y) = write_string_to_grid(
"loading...",
grid,
Color::Byte(243),
theme_default.bg,
theme_default.attrs,
conf::value(context, "highlight").fg,
conf::value(context, "highlight").bg,
conf::value(context, "highlight").attrs,
area,
None,
);

View File

@ -179,48 +179,14 @@ impl EnvelopeView {
}
}
}
/*
* TODO: add recolor changes so that this function returns a vector of required highlights
* to pass to write_string...
pub fn plain_text_to_buf(s: &str, highlight_urls: bool) -> CellBuffer {
let mut buf = CellBuffer::from(s);
if highlight_urls {
let lines: Vec<&str> = s.split('\n').map(|l| l.trim_end()).collect();
let mut shift = 0;
let mut lidx_total = 0;
let finder = LinkFinder::new();
for r in &lines {
for l in finder.links(&r) {
let offset = if lidx_total < 10 {
3
} else if lidx_total < 100 {
4
} else if lidx_total < 1000 {
5
} else {
panic!("BUG: Message body with more than 100 urls");
};
for i in 1..=offset {
buf[(l.start() + shift - i, 0)].set_fg(Color::Byte(226));
//buf[(l.start() + shift - 2, 0)].set_fg(Color::Byte(226));
//buf[(l.start() + shift - 3, 0)].set_fg(Color::Byte(226));
}
lidx_total += 1;
}
// Each Cell represents one char so next line will be:
shift += r.chars().count() + 1;
}
}
buf
}
*/
}
impl Component for EnvelopeView {
fn draw(&mut self, grid: &mut CellBuffer, area: Area, context: &mut Context) {
let upper_left = upper_left!(area);
let bottom_right = bottom_right!(area);
let theme_default = crate::conf::value(context, "theme_default");
let email_header_theme = crate::conf::value(context, "email_header");
let y: usize = {
if self.mode == ViewMode::Raw {
@ -231,72 +197,77 @@ impl Component for EnvelopeView {
let (x, y) = write_string_to_grid(
&format!("Date: {}", self.mail.date_as_str()),
grid,
Color::Byte(33),
Color::Default,
Attr::DEFAULT,
email_header_theme.fg,
email_header_theme.bg,
email_header_theme.attrs,
area,
Some(get_x(upper_left)),
);
for x in x..=get_x(bottom_right) {
grid[(x, y)].set_ch(' ');
grid[(x, y)].set_bg(Color::Default);
grid[(x, y)].set_fg(Color::Default);
grid[(x, y)]
.set_ch(' ')
.set_fg(theme_default.fg)
.set_bg(theme_default.bg);
}
let (x, y) = write_string_to_grid(
&format!("From: {}", self.mail.field_from_to_string()),
grid,
Color::Byte(33),
Color::Default,
Attr::DEFAULT,
email_header_theme.fg,
email_header_theme.bg,
email_header_theme.attrs,
(set_y(upper_left, y + 1), bottom_right),
Some(get_x(upper_left)),
);
for x in x..=get_x(bottom_right) {
grid[(x, y)].set_ch(' ');
grid[(x, y)].set_bg(Color::Default);
grid[(x, y)].set_fg(Color::Default);
grid[(x, y)]
.set_ch(' ')
.set_fg(theme_default.fg)
.set_bg(theme_default.bg);
}
let (x, y) = write_string_to_grid(
&format!("To: {}", self.mail.field_to_to_string()),
grid,
Color::Byte(33),
Color::Default,
Attr::DEFAULT,
email_header_theme.fg,
email_header_theme.bg,
email_header_theme.attrs,
(set_y(upper_left, y + 1), bottom_right),
Some(get_x(upper_left)),
);
for x in x..=get_x(bottom_right) {
grid[(x, y)].set_ch(' ');
grid[(x, y)].set_bg(Color::Default);
grid[(x, y)].set_fg(Color::Default);
grid[(x, y)]
.set_ch(' ')
.set_fg(theme_default.fg)
.set_bg(theme_default.bg);
}
let (x, y) = write_string_to_grid(
&format!("Subject: {}", self.mail.subject()),
grid,
Color::Byte(33),
Color::Default,
Attr::DEFAULT,
email_header_theme.fg,
email_header_theme.bg,
email_header_theme.attrs,
(set_y(upper_left, y + 1), bottom_right),
Some(get_x(upper_left)),
);
for x in x..=get_x(bottom_right) {
grid[(x, y)].set_ch(' ');
grid[(x, y)].set_bg(Color::Default);
grid[(x, y)].set_fg(Color::Default);
grid[(x, y)]
.set_ch(' ')
.set_fg(theme_default.fg)
.set_bg(theme_default.bg);
}
let (x, y) = write_string_to_grid(
&format!("Message-ID: <{}>", self.mail.message_id_raw()),
grid,
Color::Byte(33),
Color::Default,
Attr::DEFAULT,
email_header_theme.fg,
email_header_theme.bg,
email_header_theme.attrs,
(set_y(upper_left, y + 1), bottom_right),
Some(get_x(upper_left)),
);
for x in x..=get_x(bottom_right) {
grid[(x, y)].set_ch(' ');
grid[(x, y)].set_bg(Color::Default);
grid[(x, y)].set_fg(Color::Default);
grid[(x, y)]
.set_ch(' ')
.set_fg(theme_default.fg)
.set_bg(theme_default.bg);
}
clear_area(
grid,
@ -322,14 +293,7 @@ impl Component for EnvelopeView {
self.mode = ViewMode::Subview;
}
_ => {
let text = {
self.attachment_to_text(&body, context)
/*
let text = self.attachment_to_text(&body);
// URL indexes must be colored (ugh..)
EnvelopeView::plain_text_to_buf(&text, self.mode == ViewMode::Url)
*/
};
let text = { self.attachment_to_text(&body, context) };
let cursor_pos = if self.mode.is_attachment() {
Some(0)
} else {

View File

@ -266,6 +266,7 @@ impl ThreadView {
width = cmp::max(width, e.index.0 * 4 + e.heading.grapheme_width() + 2);
}
let theme_default = crate::conf::value(context, "theme_default");
let highlight_theme = crate::conf::value(context, "highlight");
let mut content = CellBuffer::new_with_context(width, height, None, context);
if self.reversed {
for (y, e) in self.entries.iter().rev().enumerate() {
@ -294,12 +295,12 @@ impl ThreadView {
if e.seen {
theme_default.fg
} else {
Color::Byte(0)
highlight_theme.fg
},
if e.seen {
theme_default.bg
} else {
Color::Byte(251)
highlight_theme.bg
},
theme_default.attrs,
(
@ -308,19 +309,10 @@ impl ThreadView {
),
None,
);
{
let envelope: EnvelopeRef = context.accounts[&self.coordinates.0]
.collection
.get_env(e.msg_hash);
if envelope.has_attachments() {
content[(e.index.0 * 4 + e.heading.grapheme_width(), 2 * y)]
.set_fg(Color::Byte(103));
}
}
if let Some(len) = highlight_reply_subjects[y] {
let index = e.index.0 * 4 + 1 + e.heading.grapheme_width() - len;
let area = ((index, 2 * y), (width - 2, 2 * y));
change_colors(&mut content, area, Color::Byte(33), theme_default.bg);
change_colors(&mut content, area, highlight_theme.fg, theme_default.bg);
}
set_and_join_box(&mut content, (e.index.0 * 4, 2 * y), BoxBoundary::Vertical);
set_and_join_box(
@ -375,12 +367,12 @@ impl ThreadView {
if e.seen {
theme_default.fg
} else {
Color::Byte(0)
highlight_theme.fg
},
if e.seen {
theme_default.bg
} else {
Color::Byte(251)
highlight_theme.bg
},
theme_default.attrs,
(
@ -389,19 +381,10 @@ impl ThreadView {
),
None,
);
{
let envelope: EnvelopeRef = context.accounts[&self.coordinates.0]
.collection
.get_env(e.msg_hash);
if envelope.has_attachments() {
content[(e.index.0 * 4 + e.heading.grapheme_width(), 2 * y)]
.set_fg(Color::Byte(103));
}
}
if let Some(_len) = highlight_reply_subjects[y] {
let index = e.index.0 * 4 + 1;
let area = ((index, 2 * y), (width - 2, 2 * y));
change_colors(&mut content, area, Color::Byte(33), theme_default.bg);
change_colors(&mut content, area, highlight_theme.fg, theme_default.bg);
}
set_and_join_box(&mut content, (e.index.0 * 4, 2 * y), BoxBoundary::Vertical);
set_and_join_box(
@ -439,7 +422,7 @@ impl ThreadView {
.collect();
if idx == *visibles[self.cursor_pos] {
let theme_default = crate::conf::value(context, "theme_default");
let bg_color = Color::Byte(246);
let bg_color = crate::conf::value(context, "highlight").bg;
let attrs = if self.use_color {
theme_default.attrs
} else {
@ -695,7 +678,7 @@ impl ThreadView {
let (x, y) = write_string_to_grid(
&envelope.subject(),
grid,
Color::Byte(33),
crate::conf::value(context, "highlight").fg,
theme_default.bg,
theme_default.attrs,
area,
@ -729,7 +712,7 @@ impl ThreadView {
for x in get_x(upper_left)..=get_x(bottom_right) {
set_and_join_box(grid, (x, y - 1), BoxBoundary::Horizontal);
grid[(x, y - 1)]
.set_fg(Color::Byte(33))
.set_fg(theme_default.fg)
.set_bg(theme_default.bg);
}
@ -803,7 +786,7 @@ impl ThreadView {
let (x, y) = write_string_to_grid(
&envelope.subject(),
grid,
Color::Byte(33),
theme_default.fg,
theme_default.bg,
theme_default.attrs,
area,

View File

@ -230,9 +230,9 @@ impl StatusBar {
let (_, y) = write_string_to_grid(
self.ex_buffer.as_str(),
grid,
Color::Byte(219),
Color::Byte(88),
Attr::DEFAULT,
crate::conf::value(context, "status.command_bar").fg,
crate::conf::value(context, "status.command_bar").bg,
crate::conf::value(context, "status.command_bar").attrs,
area,
None,
);
@ -242,7 +242,12 @@ impl StatusBar {
) {
cell.set_attrs(Attr::UNDERLINE);
}
change_colors(grid, area, Color::Byte(219), Color::Byte(88));
change_colors(
grid,
area,
crate::conf::value(context, "status.command_bar").fg,
crate::conf::value(context, "status.command_bar").bg,
);
context.dirty_areas.push_back(area);
}
}
@ -387,8 +392,8 @@ impl Component for StatusBar {
change_colors(
grid,
hist_area,
Color::Byte(197), // DeepPink2,
Color::Byte(174), //LightPink3
crate::conf::value(context, "status.history").fg,
crate::conf::value(context, "status.history").bg,
);
context.dirty_areas.push_back(hist_area);
hist_area
@ -420,8 +425,8 @@ impl Component for StatusBar {
change_colors(
grid,
hist_area,
Color::Byte(88), // DarkRed,
Color::Byte(174), //LightPink3
crate::conf::value(context, "status.history.hints").fg,
crate::conf::value(context, "status.history.hints").bg,
);
}
for (y_offset, s) in self
@ -435,9 +440,9 @@ impl Component for StatusBar {
let (x, y) = write_string_to_grid(
s.as_str(),
grid,
Color::Byte(88), // DarkRed,
Color::Byte(174), //LightPink3
Attr::DEFAULT,
crate::conf::value(context, "status.history.hints").fg,
crate::conf::value(context, "status.history.hints").bg,
crate::conf::value(context, "status.history.hints").attrs,
(
set_y(
upper_left!(hist_area),
@ -450,9 +455,9 @@ impl Component for StatusBar {
write_string_to_grid(
&s.description,
grid,
Color::White,
Color::Byte(174),
Attr::DEFAULT,
crate::conf::value(context, "status.history.hints").fg,
crate::conf::value(context, "status.history.hints").bg,
crate::conf::value(context, "status.history.hints").attrs,
((x + 2, y), bottom_right!(hist_area)),
None,
);
@ -469,15 +474,15 @@ impl Component for StatusBar {
get_y(bottom_right!(hist_area)) - hist_height + y_offset + 1,
),
),
Color::Byte(88), // DarkRed,
Color::Byte(173), //LightSalmon3
crate::conf::value(context, "status.history.hints").fg,
crate::conf::value(context, "status.history.hints").bg,
);
write_string_to_grid(
&s.as_str()[self.ex_buffer.as_str().len()..],
grid,
Color::Byte(97), // MediumPurple3,
Color::Byte(88), //LightPink3
Attr::DEFAULT,
crate::conf::value(context, "status.history.hints").fg,
crate::conf::value(context, "status.history.hints").bg,
crate::conf::value(context, "status.history.hints").attrs,
(
(
get_x(upper_left)
@ -891,8 +896,6 @@ impl Tabbed {
.iter_mut()
{
c.set_ch(' ').set_bg(tab_unfocused_attribute.bg);
//.set_fg(tab_unfocused_attribute.bg)
//.set_bg(Color::Byte(7));
}
if self.cursor_pos == self.children.len() - 1 {

View File

@ -355,8 +355,8 @@ impl Pager {
);
if l.starts_with("") {
grid[upper_left]
.set_fg(Color::Byte(240))
.set_attrs(Attr::BOLD);
.set_fg(crate::conf::value(context, "highlight").fg)
.set_attrs(crate::conf::value(context, "highlight").attrs);
}
upper_left = pos_inc(upper_left, (0, 1));
}

View File

@ -121,8 +121,8 @@ impl Field {
change_colors(
grid,
(pos_inc(upper_left, (pos, 0)), pos_inc(upper_left, (pos, 0))),
Color::Default,
Color::Byte(248),
crate::conf::value(context, "theme_default").fg,
crate::conf::value(context, "highlight").bg,
);
if term.grapheme_len() <= 2 {
return;
@ -810,7 +810,7 @@ where
grid,
theme_default.fg,
if i == self.cursor && self.focus {
Color::Byte(246)
crate::conf::value(context, "highlight").bg
} else {
theme_default.bg
},
@ -965,8 +965,8 @@ impl Component for AutoComplete {
get_y(pos_inc(upper_left, (0, (self.cursor - 1) % rows))),
),
),
Color::Default,
Color::Byte(246),
crate::conf::value(context, "highlight").fg,
crate::conf::value(context, "highlight").bg,
);
}
if rows < self.entries.len() {
@ -1020,6 +1020,7 @@ impl AutoComplete {
return false;
}
// FIXME: remove hardcoded color values
let mut content = CellBuffer::new(
entries
.iter()

View File

@ -244,7 +244,13 @@ fn unlink_attrs<'k, 't: 'k>(theme: &'t Theme, mut key: &'k Cow<'static, str>) ->
const DEFAULT_KEYS: &[&str] = &[
"theme_default",
"error_message",
"email_header",
"highlight",
"status.bar",
"status.command_bar",
"status.history",
"status.history.hints",
"status.notification",
"tab.focused",
"tab.unfocused",
@ -1312,7 +1318,17 @@ impl Default for Themes {
};
}
add!("theme_default", dark = { fg: Color::Default, bg: Color::Default, attrs: Attr::DEFAULT }, light = { fg: Color::Default, bg: Color::Default, attrs: Attr::DEFAULT });
add!("error_message", dark = { fg: Color::Byte(243), bg: Color::Default, attrs: Attr::DEFAULT }, light = { fg: Color::Byte(243), bg: Color::Default, attrs: Attr::DEFAULT });
add!("email_header", dark = { fg: Color::Byte(33), bg: Color::Default, attrs: Attr::DEFAULT }, light = { fg: Color::Byte(33), bg: Color::Default, attrs: Attr::DEFAULT });
add!("highlight", dark = { fg: Color::Byte(240), bg: Color::Byte(237), attrs: Attr::BOLD }, light = { fg: Color::Byte(240), bg: Color::Byte(237), attrs: Attr::BOLD });
add!("status.bar", dark = { fg: Color::Byte(123), bg: Color::Byte(26) }, light = { fg: Color::Byte(123), bg: Color::Byte(26) });
add!("status.command_bar", dark = { fg: Color::Byte(219), bg: Color::Byte(88) }, light = { fg: Color::Byte(219), bg: Color::Byte(88) });
add!("status.history", dark = { fg: Color::Byte(197), bg: Color::Byte(174) }, light = { fg: Color::Byte(197), bg: Color::Byte(174) });
add!("status.history.hints", dark = { fg: Color::Black, bg: "status.command_bar" }, light = { fg: Color::Black, bg: "status.command_bar" });
add!("status.notification", dark = { fg: Color::Byte(219), bg: Color::Default }, light = { fg: Color::Byte(219), bg: Color::Default });
add!("tab.focused");

View File

@ -1381,7 +1381,6 @@ pub mod boundaries {
break;
} else if adj == 0b0100 {
cell.set_ch(bin_to_ch(0b0101));
cell.set_fg(Color::Byte(240));
bin_set |= 0b0100;
break;
}
@ -1422,7 +1421,6 @@ pub mod boundaries {
if let Some(cell) = grid.get_mut(x, y - 1) {
if let Some(adj) = ch_to_bin(cell.ch()) {
cell.set_ch(bin_to_ch(adj | 0b1000));
cell.set_fg(Color::Byte(240));
} else {
bin_set &= 0b1101;
}
@ -1441,7 +1439,6 @@ pub mod boundaries {
if let Some(cell) = grid.get_mut(x, y + 1) {
if let Some(adj) = ch_to_bin(cell.ch()) {
cell.set_ch(bin_to_ch(adj | 0b0010));
cell.set_fg(Color::Byte(240));
} else {
bin_set &= 0b0111;
}
@ -1476,7 +1473,6 @@ pub mod boundaries {
} else if adj == 0b0010 {
bin_set |= 0b0010;
cell.set_ch(bin_to_ch(0b1010));
cell.set_fg(Color::Byte(240));
break;
}
}
@ -1501,7 +1497,6 @@ pub mod boundaries {
} else if adj == 0b1000 {
bin_set |= 0b1000;
cell.set_ch(bin_to_ch(0b1010));
cell.set_fg(Color::Byte(240));
break;
}
}
@ -1521,7 +1516,6 @@ pub mod boundaries {
if let Some(cell) = grid.get_mut(x - 1, y) {
if let Some(adj) = ch_to_bin(cell.ch()) {
cell.set_ch(bin_to_ch(adj | 0b0001));
cell.set_fg(Color::Byte(240));
} else {
bin_set &= 0b1011;
}
@ -1540,7 +1534,6 @@ pub mod boundaries {
if let Some(cell) = grid.get_mut(x + 1, y) {
if let Some(adj) = ch_to_bin(cell.ch()) {
cell.set_ch(bin_to_ch(adj | 0b0100));
cell.set_fg(Color::Byte(240));
} else {
bin_set &= 0b1110;
}
@ -1576,8 +1569,6 @@ pub mod boundaries {
BoxBoundary::Vertical => '|',
BoxBoundary::Horizontal => '-',
});
grid[idx].set_fg(Color::Byte(240));
return;
}
@ -1587,7 +1578,6 @@ pub mod boundaries {
};
grid[idx].set_ch(bin_to_ch(bin_set));
grid[idx].set_fg(Color::Byte(240));
}
/// Puts boundaries in `area`.
@ -1601,21 +1591,13 @@ pub mod boundaries {
if !grid.ascii_drawing {
for x in get_x(upper_left)..get_x(bottom_right) {
grid[(x, get_y(upper_left))]
.set_ch(HORZ_BOUNDARY)
.set_fg(Color::Byte(240));
grid[(x, get_y(bottom_right))]
.set_ch(HORZ_BOUNDARY)
.set_fg(Color::Byte(240));
grid[(x, get_y(upper_left))].set_ch(HORZ_BOUNDARY);
grid[(x, get_y(bottom_right))].set_ch(HORZ_BOUNDARY);
}
for y in get_y(upper_left)..get_y(bottom_right) {
grid[(get_x(upper_left), y)]
.set_ch(VERT_BOUNDARY)
.set_fg(Color::Byte(240));
grid[(get_x(bottom_right), y)]
.set_ch(VERT_BOUNDARY)
.set_fg(Color::Byte(240));
grid[(get_x(upper_left), y)].set_ch(VERT_BOUNDARY);
grid[(get_x(bottom_right), y)].set_ch(VERT_BOUNDARY);
}
set_and_join_box(grid, upper_left, BoxBoundary::Horizontal);
set_and_join_box(