mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-28 01:40:17 -05:00
config: make selection foreground/background colors configurable
The default is still to inverse the regular foreground/background colors. If the user sets *both* of the new options, selection-foreground and selection-background, those colors will *always* be used for selected cells, instead of inverting the regular foreground/background colors.
This commit is contained in:
parent
156cce6ef6
commit
5e36ebdef8
6 changed files with 33 additions and 8 deletions
20
render.c
20
render.c
|
|
@ -384,15 +384,19 @@ render_cell(struct terminal *term, pixman_image_t *pix,
|
|||
uint32_t _fg = 0;
|
||||
uint32_t _bg = 0;
|
||||
|
||||
/* Use cell specific color, if set, otherwise the default colors (possible reversed) */
|
||||
_fg = cell->attrs.have_fg ? cell->attrs.fg : term->colors.fg;
|
||||
_bg = cell->attrs.have_bg ? cell->attrs.bg : term->colors.bg;
|
||||
if (is_selected && term->conf->colors.selection_uses_custom_colors) {
|
||||
_fg = term->conf->colors.selection_fg;
|
||||
_bg = term->conf->colors.selection_bg;
|
||||
} else {
|
||||
/* Use cell specific color, if set, otherwise the default colors (possible reversed) */
|
||||
_fg = cell->attrs.have_fg ? cell->attrs.fg : term->colors.fg;
|
||||
_bg = cell->attrs.have_bg ? cell->attrs.bg : term->colors.bg;
|
||||
|
||||
/* If *one* is set, we reverse */
|
||||
if (term->reverse ^ cell->attrs.reverse ^ is_selected) {
|
||||
uint32_t swap = _fg;
|
||||
_fg = _bg;
|
||||
_bg = swap;
|
||||
if (term->reverse ^ cell->attrs.reverse ^ is_selected) {
|
||||
uint32_t swap = _fg;
|
||||
_fg = _bg;
|
||||
_bg = swap;
|
||||
}
|
||||
}
|
||||
|
||||
if (cell->attrs.blink && term->blink.state == BLINK_OFF)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue