themes: add indentation level color keys
Add theme keys for the indentation level colors in ThreadViewmaster
parent
b3b9563db0
commit
bee1baedb2
|
@ -23,15 +23,6 @@ use super::*;
|
|||
use crate::components::utilities::PageMovement;
|
||||
use std::cmp;
|
||||
|
||||
const INDENTATION_COLORS: &'static [u8] = &[
|
||||
69, // CornflowerBlue
|
||||
196, // Red1
|
||||
175, // Pink3
|
||||
220, // Gold1
|
||||
172, // Orange3
|
||||
072, // CadetBlue
|
||||
];
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
struct ThreadEntry {
|
||||
index: (usize, ThreadNodeHash, usize),
|
||||
|
@ -58,6 +49,7 @@ pub struct ThreadView {
|
|||
show_thread: bool,
|
||||
entries: Vec<ThreadEntry>,
|
||||
visible_entries: Vec<Vec<usize>>,
|
||||
indentation_colors: [ThemeAttribute; 6],
|
||||
|
||||
movement: Option<PageMovement>,
|
||||
dirty: bool,
|
||||
|
@ -91,6 +83,14 @@ impl ThreadView {
|
|||
new_cursor_pos: 0,
|
||||
dirty: true,
|
||||
id: ComponentId::new_v4(),
|
||||
indentation_colors: [
|
||||
crate::conf::value(context, "mail.view.thread.indentation.a"),
|
||||
crate::conf::value(context, "mail.view.thread.indentation.b"),
|
||||
crate::conf::value(context, "mail.view.thread.indentation.c"),
|
||||
crate::conf::value(context, "mail.view.thread.indentation.d"),
|
||||
crate::conf::value(context, "mail.view.thread.indentation.e"),
|
||||
crate::conf::value(context, "mail.view.thread.indentation.f"),
|
||||
],
|
||||
..Default::default()
|
||||
};
|
||||
view.initiate(expanded_hash, context);
|
||||
|
@ -306,12 +306,13 @@ impl ThreadView {
|
|||
/* Box character drawing stuff */
|
||||
let mut x = 0;
|
||||
for i in 0..e.index.0 {
|
||||
let color = INDENTATION_COLORS[(i).wrapping_rem(INDENTATION_COLORS.len())];
|
||||
let att =
|
||||
self.indentation_colors[(i).wrapping_rem(self.indentation_colors.len())];
|
||||
change_colors(
|
||||
&mut content,
|
||||
((x, 2 * y), (x + 3, 2 * y + 1)),
|
||||
Color::Default,
|
||||
Color::Byte(color),
|
||||
att.fg,
|
||||
att.bg,
|
||||
);
|
||||
x += 4;
|
||||
}
|
||||
|
|
|
@ -199,6 +199,12 @@ const DEFAULT_KEYS: &'static [&'static str] = &[
|
|||
"mail.listing.conversations.selected",
|
||||
"mail.view.headers",
|
||||
"mail.view.body",
|
||||
"mail.view.thread.indentation.a",
|
||||
"mail.view.thread.indentation.b",
|
||||
"mail.view.thread.indentation.c",
|
||||
"mail.view.thread.indentation.d",
|
||||
"mail.view.thread.indentation.e",
|
||||
"mail.view.thread.indentation.f",
|
||||
"mail.listing.attachment_flag",
|
||||
"mail.listing.thread_snooze_flag",
|
||||
"mail.listing.tag_default",
|
||||
|
@ -857,6 +863,12 @@ impl Default for Theme {
|
|||
}
|
||||
);
|
||||
add!("mail.view.body");
|
||||
add!("mail.view.thread.indentation.a", light = { bg: Color::Byte(69) }, dark = { bg: Color::Byte(69) }); // CornflowerBlue
|
||||
add!("mail.view.thread.indentation.b", light = { bg: Color::Byte(196) }, dark = { bg: Color::Byte(196) }); // Red1
|
||||
add!("mail.view.thread.indentation.c", light = { bg: Color::Byte(175) }, dark = { bg: Color::Byte(175) }); // Pink3
|
||||
add!("mail.view.thread.indentation.d", light = { bg: Color::Byte(220) }, dark = { bg: Color::Byte(220) }); // Gold1
|
||||
add!("mail.view.thread.indentation.e", light = { bg: Color::Byte(172) }, dark = { bg: Color::Byte(172) }); // Orange3
|
||||
add!("mail.view.thread.indentation.f", light = { bg: Color::Byte(072) }, dark = { bg: Color::Byte(072) }); // CadetBlue
|
||||
|
||||
add!(
|
||||
"mail.listing.attachment_flag",
|
||||
|
|
Loading…
Reference in New Issue