aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2025-04-19 05:46:06 +0000
committerDaniel Eklöf <daniel@ekloef.se>2025-04-19 11:33:23 +0000
commit1a2e5f4932a17c9804ca6d201b7d8cf84d7f19d9 (patch)
tree1cc6db71597f1a007cffa4856ca3348ab6e5a1b8
parentdoc: foot.ini: spaces -> tab (for indentation) (diff)
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.
-rw-r--r--CHANGELOG.md4
-rw-r--r--render.c9
2 files changed, 12 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d8787775..6958c869 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -66,6 +66,10 @@
### Deprecated
### Removed
### Fixed
+
+* `colors.alpha-mode=matching` not working as intended.
+
+
### Security
### Contributors
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;
}