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 {{{

View file

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

View file

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