From b218b8cfb0938b44cf75209d342c20240d9f8ef3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sat, 25 Dec 2021 21:22:40 +0100 Subject: [PATCH] =?UTF-8?q?sixel:=20VT=20state=E2=80=99s=20bg=20color=20ma?= =?UTF-8?q?y=20now=20be=20an=20index,=20rather=20than=20an=20actual=20colo?= =?UTF-8?q?r=20value?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sixel.c | 21 ++++++++++++++++++--- 1 file 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;