mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05: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
|
|
@ -41,6 +41,8 @@
|
|||
* Dedicated bell section in config, supporting multiple actions and
|
||||
a new `command` action to run an arbitrary command.
|
||||
(https://codeberg.org/dnkl/foot/pulls/483)
|
||||
* Support for setting the full 256 color palette in foot.ini
|
||||
(https://codeberg.org/dnkl/foot/issues/489)
|
||||
|
||||
|
||||
### Changed
|
||||
|
|
|
|||
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];
|
||||
|
|
|
|||
|
|
@ -375,9 +375,9 @@ applications can change these at runtime.
|
|||
|
||||
# SECTION: colors
|
||||
|
||||
This section controls the 16 ANSI colors and the default foreground
|
||||
and background colors. Note that applications can change these at
|
||||
runtime.
|
||||
This section controls the 16 ANSI colors, the default foreground
|
||||
and background colors, and the extended 256 color palette. Note that
|
||||
applications can change these at runtime.
|
||||
|
||||
The colors are in RRGGBB format. That is, they do *not* have an alpha
|
||||
component. You can configure the background transparency with the
|
||||
|
|
@ -401,6 +401,12 @@ _alpha_ option.
|
|||
_bfebbf_, _f0dfaf_, _8cd0d3_, _fcace3_, _b3ffff_ and _ffffff_ (a
|
||||
variant of the _zenburn_ theme).
|
||||
|
||||
*0* *..* *255*
|
||||
Arbitrary colors in the 256-color palette. Default: for *0* *..*
|
||||
*15*, see regular and bright defaults above; see
|
||||
https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit for an
|
||||
explanation of the remainder.
|
||||
|
||||
*alpha*
|
||||
Background translucency. A value in the range 0.0-1.0, where 0.0
|
||||
means completely transparent, and 1.0 is opaque. Default: _1.0_.
|
||||
|
|
|
|||
3
foot.ini
3
foot.ini
|
|
@ -74,6 +74,9 @@
|
|||
# bright5=fcace3 # bright magenta
|
||||
# bright6=b3ffff # bright cyan
|
||||
# bright7=ffffff # bright white
|
||||
# 16 = <256-color palette #16>
|
||||
# ...
|
||||
# 255 = <256-color palette #255>
|
||||
# selection-foreground=<inverse foreground/background>
|
||||
# selection-background=<inverse foreground/background>
|
||||
# jump-labels=<regular0> <regular3>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue