From 1a2e5f4932a17c9804ca6d201b7d8cf84d7f19d9 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sat, 19 Apr 2025 07:46:06 +0200 Subject: render: fix colors.alpha-mode=matching Before this patch, it only matched RGB color sources. It did not match the default bg color, or indexed colors. That is, e.g. CSI 43m didn't apply alpha, even if the color3 matched the default background color. --- render.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'render.c') diff --git a/render.c b/render.c index fdf7015c..0e403949 100644 --- a/render.c +++ b/render.c @@ -754,8 +754,15 @@ render_cell(struct terminal *term, pixman_image_t *pix, } case ALPHA_MODE_MATCHING: { - if (cell->attrs.bg == term->colors.bg) + if (cell->attrs.bg_src == COLOR_DEFAULT || + ((cell->attrs.bg_src == COLOR_BASE16 || + cell->attrs.bg_src == COLOR_BASE256) && + term->colors.table[cell->attrs.bg] == term->colors.bg) || + (cell->attrs.bg_src == COLOR_RGB && + cell->attrs.bg == term->colors.bg)) + { alpha = term->colors.alpha; + } break; } -- cgit v1.3 From cb1b7ba0c5752eeb92c72a80640fbd1f09ad4b7d Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Fri, 25 Apr 2025 19:20:36 +0200 Subject: render: regression: alpha applied to inversed text/selections Introduced by 5f83278afd0530c323d4192e1095b3d1dea644c9 Closes #2073 --- CHANGELOG.md | 2 ++ render.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'render.c') diff --git a/CHANGELOG.md b/CHANGELOG.md index 3edd8212..3e9ce91c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -76,6 +76,8 @@ * Fallback font (and possibly wrong color) being used when a character was followed by a zero-width grapheme breaking codepoint (for example, _LEFT-TO-RIGHT MARK_) ([#2049][2049]). +* Regression: alpha applied to inversed text/selections + ([#2073][2073]). [2039]: https://codeberg.org/dnkl/foot/issues/2039 [2034]: https://codeberg.org/dnkl/foot/issues/2034 diff --git a/render.c b/render.c index 0e403949..b0d21d18 100644 --- a/render.c +++ b/render.c @@ -744,7 +744,7 @@ render_cell(struct terminal *term, pixman_image_t *pix, _bg = swap; } - if (!term->window->is_fullscreen && term->colors.alpha != 0xffff) { + else if (!term->window->is_fullscreen && term->colors.alpha != 0xffff) { switch (term->conf->colors.alpha_mode) { case ALPHA_MODE_DEFAULT: { if (cell->attrs.bg_src == COLOR_DEFAULT) { -- cgit v1.3