mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-15 08:21:03 -04:00
Add options for custom background colors
This commit is contained in:
parent
83303bd2a4
commit
64682f642d
5 changed files with 33 additions and 1 deletions
9
config.c
9
config.c
|
|
@ -1388,6 +1388,15 @@ parse_color_theme(struct context *ctx, struct color_theme *theme)
|
|||
return true;
|
||||
}
|
||||
|
||||
else if (key_len == 11 && str_has_prefix(key, "background") && last_digit < 8)
|
||||
{
|
||||
if (!value_to_color(ctx, &theme->background[last_digit], false))
|
||||
return false;
|
||||
|
||||
theme->use_custom.background |= 1 << last_digit;
|
||||
return true;
|
||||
}
|
||||
|
||||
else if (str_has_prefix(key, "sixel") &&
|
||||
((key_len == 6 && last_digit < 10) ||
|
||||
(key_len == 7 && key[5] == '1' && last_digit < 6)))
|
||||
|
|
|
|||
2
config.h
2
config.h
|
|
@ -143,6 +143,7 @@ struct color_theme {
|
|||
uint32_t url;
|
||||
|
||||
uint32_t dim[8];
|
||||
uint32_t background[8];
|
||||
uint32_t sixel[16];
|
||||
|
||||
enum {
|
||||
|
|
@ -186,6 +187,7 @@ struct color_theme {
|
|||
bool search_box_no_match:1;
|
||||
bool search_box_match:1;
|
||||
uint8_t dim;
|
||||
uint8_t background;
|
||||
} use_custom;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1017,6 +1017,14 @@ dark theme (since the default theme is dark).
|
|||
_e9e836_, _5dc5f8_, _feabf2_, _24dfc4_, _ffffff_ (starlight
|
||||
theme, V4).
|
||||
|
||||
*background0*, *background1* *..* *background7*
|
||||
Custom colors to use for background colors. By default the eight
|
||||
foreground colors are used.
|
||||
|
||||
Note that applications can change the *regularN* colors at runtime
|
||||
which affects the background colors when *backgroundN* is not
|
||||
defined.
|
||||
|
||||
*dim0*, *dim1* *..* *dim7*
|
||||
Custom colors to use with dimmed colors. Dimmed colors do not have
|
||||
an entry in the color palette. Applications emit them by combining
|
||||
|
|
|
|||
10
foot.ini
10
foot.ini
|
|
@ -134,6 +134,16 @@
|
|||
# ...
|
||||
# dim7=<not-set>
|
||||
|
||||
## custom background colors (see foot.ini(5) man page)
|
||||
# background0=<not set> # black
|
||||
# background1=<not set> # red
|
||||
# background2=<not set> # green
|
||||
# background3=<not set> # yellow
|
||||
# background4=<not set> # blue
|
||||
# background5=<not set> # magenta
|
||||
# background6=<not set> # cyan
|
||||
# background7=<not set> # white
|
||||
|
||||
## The remaining 256-color palette
|
||||
# 16 = <256-color palette #16>
|
||||
# ...
|
||||
|
|
|
|||
5
render.c
5
render.c
|
|
@ -725,7 +725,10 @@ render_cell(struct terminal *term, pixman_image_t *pix,
|
|||
case COLOR_BASE16:
|
||||
case COLOR_BASE256:
|
||||
xassert(cell->attrs.bg < ALEN(term->colors.table));
|
||||
_bg = term->colors.table[cell->attrs.bg];
|
||||
if (cell->attrs.bg < 8 && term->conf->colors.use_custom.background & (1 << cell->attrs.bg))
|
||||
_bg = term->conf->colors.background[cell->attrs.bg];
|
||||
else
|
||||
_bg = term->colors.table[cell->attrs.bg];
|
||||
break;
|
||||
|
||||
case COLOR_DEFAULT:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue