themes: add default tag theme attribute
The theme attribute key is "mail.listing.tag_default"memfd
parent
6ccb9d3d75
commit
840005022c
|
@ -58,6 +58,7 @@ struct ColorCache {
|
|||
selected: ThemeAttribute,
|
||||
attachment_flag: ThemeAttribute,
|
||||
thread_snooze_flag: ThemeAttribute,
|
||||
tag_default: ThemeAttribute,
|
||||
|
||||
/* Conversations */
|
||||
subject: ThemeAttribute,
|
||||
|
@ -118,7 +119,7 @@ column_str!(struct DateString(String));
|
|||
column_str!(struct FromString(String));
|
||||
column_str!(struct SubjectString(String));
|
||||
column_str!(struct FlagString(String));
|
||||
column_str!(struct TagString(String, SmallVec<[Color; 8]>));
|
||||
column_str!(struct TagString(String, SmallVec<[Option<Color>; 8]>));
|
||||
|
||||
#[derive(Debug)]
|
||||
struct AccountMenuEntry {
|
||||
|
|
|
@ -122,6 +122,7 @@ impl MailListingTrait for CompactListing {
|
|||
selected: crate::conf::value(context, "mail.listing.compact.selected"),
|
||||
attachment_flag: crate::conf::value(context, "mail.listing.attachment_flag"),
|
||||
thread_snooze_flag: crate::conf::value(context, "mail.listing.thread_snooze_flag"),
|
||||
tag_default: crate::conf::value(context, "mail.listing.tag_default"),
|
||||
theme_default: crate::conf::value(context, "theme_default"),
|
||||
..self.color_cache
|
||||
};
|
||||
|
@ -668,14 +669,11 @@ impl CompactListing {
|
|||
tags.push(' ');
|
||||
tags.push_str(tags_lck.get(t).as_ref().unwrap());
|
||||
tags.push(' ');
|
||||
if let Some(&c) =
|
||||
colors.push(
|
||||
mailbox_settings!(context[self.cursor_pos.0][&self.cursor_pos.1].tags.colors)
|
||||
.get(t)
|
||||
{
|
||||
colors.push(c);
|
||||
} else {
|
||||
colors.push(Color::Byte(8));
|
||||
}
|
||||
.map(|&c| c),
|
||||
);
|
||||
}
|
||||
if !tags.is_empty() {
|
||||
tags.pop();
|
||||
|
@ -927,12 +925,13 @@ impl CompactListing {
|
|||
let x = {
|
||||
let mut x = x + 1;
|
||||
for (t, &color) in strings.tags.split_whitespace().zip(strings.tags.1.iter()) {
|
||||
let color = color.unwrap_or(self.color_cache.tag_default.bg);
|
||||
let (_x, _) = write_string_to_grid(
|
||||
t,
|
||||
&mut self.data_columns.columns[4],
|
||||
Color::White,
|
||||
self.color_cache.tag_default.fg,
|
||||
color,
|
||||
Attr::Bold,
|
||||
self.color_cache.tag_default.attrs,
|
||||
((x + 1, idx), (min_width.4, idx)),
|
||||
None,
|
||||
);
|
||||
|
@ -1096,12 +1095,13 @@ impl CompactListing {
|
|||
let x = {
|
||||
let mut x = x + 1;
|
||||
for (t, &color) in strings.tags.split_whitespace().zip(strings.tags.1.iter()) {
|
||||
let color = color.unwrap_or(self.color_cache.tag_default.bg);
|
||||
let (_x, _) = write_string_to_grid(
|
||||
t,
|
||||
&mut columns[4],
|
||||
Color::White,
|
||||
self.color_cache.tag_default.fg,
|
||||
color,
|
||||
Attr::Bold,
|
||||
self.color_cache.tag_default.attrs,
|
||||
((x + 1, idx), (min_width.4, idx)),
|
||||
None,
|
||||
);
|
||||
|
|
|
@ -109,6 +109,7 @@ impl MailListingTrait for ConversationsListing {
|
|||
highlighted: crate::conf::value(context, "mail.listing.conversations.highlighted"),
|
||||
attachment_flag: crate::conf::value(context, "mail.listing.attachment_flag"),
|
||||
thread_snooze_flag: crate::conf::value(context, "mail.listing.thread_snooze_flag"),
|
||||
tag_default: crate::conf::value(context, "mail.listing.tag_default"),
|
||||
..self.color_cache
|
||||
};
|
||||
|
||||
|
@ -611,14 +612,11 @@ impl ConversationsListing {
|
|||
tags.push(' ');
|
||||
tags.push_str(tags_lck.get(t).as_ref().unwrap());
|
||||
tags.push(' ');
|
||||
if let Some(&c) =
|
||||
colors.push(
|
||||
mailbox_settings!(context[self.cursor_pos.0][&self.cursor_pos.1].tags.colors)
|
||||
.get(t)
|
||||
{
|
||||
colors.push(c);
|
||||
} else {
|
||||
colors.push(Color::Byte(8));
|
||||
}
|
||||
.map(|&c| c),
|
||||
);
|
||||
}
|
||||
if !tags.is_empty() {
|
||||
tags.pop();
|
||||
|
@ -785,12 +783,13 @@ impl ConversationsListing {
|
|||
None,
|
||||
);
|
||||
for (t, &color) in strings.tags.split_whitespace().zip(strings.tags.1.iter()) {
|
||||
let color = color.unwrap_or(self.color_cache.tag_default.bg);
|
||||
let (_x, _) = write_string_to_grid(
|
||||
t,
|
||||
&mut self.content,
|
||||
Color::White,
|
||||
self.color_cache.tag_default.fg,
|
||||
color,
|
||||
Attr::Bold,
|
||||
self.color_cache.tag_default.attrs,
|
||||
((x + 1, 3 * idx), (width - 1, 3 * idx)),
|
||||
None,
|
||||
);
|
||||
|
@ -992,12 +991,13 @@ impl ConversationsListing {
|
|||
let x = {
|
||||
let mut x = x + 1;
|
||||
for (t, &color) in strings.tags.split_whitespace().zip(strings.tags.1.iter()) {
|
||||
let color = color.unwrap_or(self.color_cache.tag_default.bg);
|
||||
let (_x, _) = write_string_to_grid(
|
||||
t,
|
||||
&mut self.content,
|
||||
Color::White,
|
||||
self.color_cache.tag_default.fg,
|
||||
color,
|
||||
Attr::Bold,
|
||||
self.color_cache.tag_default.attrs,
|
||||
((x + 1, 3 * idx), (width - 1, 3 * idx)),
|
||||
None,
|
||||
);
|
||||
|
|
|
@ -123,6 +123,7 @@ impl MailListingTrait for PlainListing {
|
|||
selected: crate::conf::value(context, "mail.listing.plain.selected"),
|
||||
attachment_flag: crate::conf::value(context, "mail.listing.attachment_flag"),
|
||||
thread_snooze_flag: crate::conf::value(context, "mail.listing.thread_snooze_flag"),
|
||||
tag_default: crate::conf::value(context, "mail.listing.tag_default"),
|
||||
..self.color_cache
|
||||
};
|
||||
if !context.settings.terminal.use_color() {
|
||||
|
@ -632,14 +633,11 @@ impl PlainListing {
|
|||
tags.push(' ');
|
||||
tags.push_str(tags_lck.get(t).as_ref().unwrap());
|
||||
tags.push(' ');
|
||||
if let Some(&c) =
|
||||
colors.push(
|
||||
mailbox_settings!(context[self.cursor_pos.0][&self.cursor_pos.1].tags.colors)
|
||||
.get(t)
|
||||
{
|
||||
colors.push(c);
|
||||
} else {
|
||||
colors.push(Color::Byte(8));
|
||||
}
|
||||
.map(|&c| c),
|
||||
);
|
||||
}
|
||||
if !tags.is_empty() {
|
||||
tags.pop();
|
||||
|
@ -859,12 +857,13 @@ impl PlainListing {
|
|||
let x = {
|
||||
let mut x = x + 1;
|
||||
for (t, &color) in strings.tags.split_whitespace().zip(strings.tags.1.iter()) {
|
||||
let color = color.unwrap_or(self.color_cache.tag_default.bg);
|
||||
let (_x, _) = write_string_to_grid(
|
||||
t,
|
||||
&mut columns[4],
|
||||
Color::White,
|
||||
self.color_cache.tag_default.fg,
|
||||
color,
|
||||
Attr::Bold,
|
||||
self.color_cache.tag_default.attrs,
|
||||
((x + 1, idx), (min_width.4, idx)),
|
||||
None,
|
||||
);
|
||||
|
|
|
@ -195,6 +195,7 @@ const DEFAULT_KEYS: &'static [&'static str] = &[
|
|||
"mail.view.body",
|
||||
"mail.listing.attachment_flag",
|
||||
"mail.listing.thread_snooze_flag",
|
||||
"mail.listing.tag_default",
|
||||
"pager.highlight_search",
|
||||
"pager.highlight_search_current",
|
||||
];
|
||||
|
@ -719,6 +720,20 @@ impl Default for Theme {
|
|||
}
|
||||
);
|
||||
|
||||
add!(
|
||||
"mail.listing.tag_default",
|
||||
light = {
|
||||
fg: Color::White,
|
||||
bg: Color::Byte(8),
|
||||
attrs: Attr::Bold
|
||||
},
|
||||
dark = {
|
||||
fg: Color::White,
|
||||
bg: Color::Byte(8),
|
||||
attrs: Attr::Bold
|
||||
}
|
||||
);
|
||||
|
||||
add!("pager.highlight_search", light = { fg: Color::White, bg: Color::Byte(6) /* Teal */, attrs: Attr::Bold }, dark = { fg: Color::White, bg: Color::Byte(6) /* Teal */, attrs: Attr::Bold });
|
||||
add!("pager.highlight_search_current", light = { fg: Color::White, bg: Color::Byte(17) /* NavyBlue */, attrs: Attr::Bold }, dark = { fg: Color::White, bg: Color::Byte(17) /* NavyBlue */, attrs: Attr::Bold });
|
||||
Theme {
|
||||
|
|
Loading…
Reference in New Issue