mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-14 08:21:27 -04:00
configure full color palette in foot.ini
Allow the use of numeric keys in [colors] to configure the full set of 256 colors in the palette. Fixes #489
This commit is contained in:
parent
63572e4223
commit
3b089b4203
4 changed files with 28 additions and 4 deletions
15
config.c
15
config.c
|
|
@ -902,7 +902,20 @@ parse_section_colors(const char *key, const char *value, struct config *conf,
|
|||
{
|
||||
uint32_t *color = NULL;
|
||||
|
||||
if (strcmp(key, "foreground") == 0) color = &conf->colors.fg;
|
||||
if (isdigit(key[0])) {
|
||||
unsigned long index;
|
||||
if (!str_to_ulong(key, 0, &index)) {
|
||||
LOG_AND_NOTIFY_ERR("%s:%d: [colors]: invalid numeric key", path, lineno);
|
||||
return false;
|
||||
}
|
||||
if (index >= ALEN(conf->colors.table)) {
|
||||
LOG_AND_NOTIFY_ERR("%s:%d: [colors]: numeric key out of range", path, lineno);
|
||||
return false;
|
||||
}
|
||||
color = &conf->colors.table[index];
|
||||
}
|
||||
|
||||
else if (strcmp(key, "foreground") == 0) color = &conf->colors.fg;
|
||||
else if (strcmp(key, "background") == 0) color = &conf->colors.bg;
|
||||
else if (strcmp(key, "regular0") == 0) color = &conf->colors.table[0];
|
||||
else if (strcmp(key, "regular1") == 0) color = &conf->colors.table[1];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue