aboutsummaryrefslogtreecommitdiff
path: root/sixel.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-12-25 20:22:40 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-12-26 11:37:48 +0000
commitb218b8cfb0938b44cf75209d342c20240d9f8ef3 (patch)
tree64bf598076f70a152c175da88a848de9f30e0afb /sixel.c
parentcsi: store color index, not actual color, in cell’s fg/bg attributes (diff)
sixel: VT state’s bg color may now be an index, rather than an actual color value
Diffstat (limited to 'sixel.c')
-rw-r--r--sixel.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/sixel.c b/sixel.c
index e50fa511..b659a3c0 100644
--- a/sixel.c
+++ b/sixel.c
@@ -68,11 +68,26 @@ sixel_init(struct terminal *term, int p1, int p2, int p3)
term->sixel.palette = term->sixel.shared_palette;
}
+ uint32_t bg = 0;
+
+ switch (term->vt.attrs.bg_src) {
+ case COLOR_RGB:
+ bg = term->vt.attrs.bg;
+ break;
+
+ case COLOR_BASE16:
+ case COLOR_BASE256:
+ bg = term->colors.table[term->vt.attrs.bg];
+ break;
+
+ case COLOR_DEFAULT:
+ bg = term->colors.bg;
+ break;
+ }
+
term->sixel.default_bg = term->sixel.transparent_bg
? 0x00000000u
- : 0xffu << 24 | (term->vt.attrs.bg_src != COLOR_DEFAULT
- ? term->vt.attrs.bg
- : term->colors.bg);
+ : 0xffu << 24 | bg;
for (size_t i = 0; i < 1 * 6; i++)
term->sixel.image.data[i] = term->sixel.default_bg;