aboutsummaryrefslogtreecommitdiff
path: root/render.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-08-13 04:22:45 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-08-13 04:22:45 +0000
commit52abf852661da0d78326e5158cc840f989e48ccb (patch)
tree06b8bc7b1c0e07341d58a4913fdca2b8169e5dae /render.c
parentdoc: foot.1: don't talk about using '--' on the command line (diff)
parentconfig: make selection foreground/background colors configurable (diff)
Merge branch 'custom-selection-colors' into master
Diffstat (limited to 'render.c')
-rw-r--r--render.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/render.c b/render.c
index 5cc82ed1..db611a50 100644
--- a/render.c
+++ b/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)