feat: theme configuration for completion

This commit is contained in:
XOR-op 2023-10-26 23:35:35 -04:00
parent 03fd890f10
commit fd81366de8
3 changed files with 29 additions and 14 deletions

View file

@ -84,6 +84,15 @@ inactive = {}
# : }}} # : }}}
# : Completion {{{
[completion]
border = { fg = "blue" }
active = { fg = "lightcyan" }
inactive = {}
# : }}}
# : Tasks {{{ # : Tasks {{{

View file

@ -81,6 +81,13 @@ pub struct Select {
pub inactive: Style, pub inactive: Style,
} }
#[derive(Deserialize, Serialize)]
pub struct Completion {
pub border: Style,
pub active: Style,
pub inactive: Style,
}
#[derive(Deserialize, Serialize)] #[derive(Deserialize, Serialize)]
pub struct Tasks { pub struct Tasks {
pub border: Style, pub border: Style,
@ -111,13 +118,14 @@ pub struct Help {
#[derive(Deserialize, Serialize)] #[derive(Deserialize, Serialize)]
pub struct Theme { pub struct Theme {
pub manager: Manager, pub manager: Manager,
status: Status, status: Status,
pub input: Input, pub input: Input,
pub select: Select, pub select: Select,
pub tasks: Tasks, pub completion: Completion,
pub which: Which, pub tasks: Tasks,
pub help: Help, pub which: Which,
pub help: Help,
// File-specific styles // File-specific styles
#[serde(rename = "filetype", deserialize_with = "Filetype::deserialize", skip_serializing)] #[serde(rename = "filetype", deserialize_with = "Filetype::deserialize", skip_serializing)]

View file

@ -35,11 +35,10 @@ impl<'a> Widget for Completion<'a> {
} else { } else {
s.split_at(max_width - 1).0.to_string() + "" s.split_at(max_width - 1).0.to_string() + ""
}) })
// todo
.style(if completion.cursor() == idx { .style(if completion.cursor() == idx {
THEME.select.active.into() THEME.completion.active.into()
} else { } else {
THEME.select.inactive.into() THEME.completion.inactive.into()
}), }),
); );
} }
@ -47,10 +46,9 @@ impl<'a> Widget for Completion<'a> {
Table::new(table) Table::new(table)
.block( .block(
Block::new() Block::new()
.borders(Borders::ALL) .borders(Borders::ALL)
.border_type(BorderType::Double) .border_type(BorderType::Double)
// todo .border_style(THEME.completion.border.into()),
.border_style(THEME.select.border.into()),
) )
.widths(&constraint) .widths(&constraint)
}; };