From 0f762475b58feb0366876156c6b0fa61063e8bd4 Mon Sep 17 00:00:00 2001 From: Gene Johnson Date: Sun, 15 Mar 2026 01:08:17 -0700 Subject: [PATCH] feat: Apply a distinct background color to firehose lines. --- engine/scroll.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/engine/scroll.py b/engine/scroll.py index 4deb47d..e6738e3 100644 --- a/engine/scroll.py +++ b/engine/scroll.py @@ -15,9 +15,10 @@ from engine.render import big_wrap, lr_gradient, make_block from engine.effects import noise, glitch_bar, fade_line, vis_trunc, next_headline, firehose_line _ANSI_LINE_RE = re.compile(r"^(\033\[[0-9;]*m)(.*)(\033\[0m)$") +FIREHOSE_BG = "\033[48;5;233m" -def _overlay_segments(ansi_line): +def _overlay_segments(ansi_line, bg=""): """Return (1-indexed column, colored chunk) for non-space runs in a line.""" m = _ANSI_LINE_RE.match(ansi_line) if m: @@ -34,7 +35,10 @@ def _overlay_segments(ansi_line): while j < len(text) and text[j] != " ": j += 1 chunk = text[i:j] - segs.append((i + 1, f"{color}{chunk}{RST}" if color else chunk)) + if bg or color: + segs.append((i + 1, f"{bg}{color}{chunk}{RST}")) + else: + segs.append((i + 1, chunk)) i = j return segs @@ -223,7 +227,9 @@ def stream(items, ntfy_poller, mic_monitor): scr_row = firehose_top + fr + 1 if scr_row <= msg_h or scr_row > h: continue - for col, chunk in _overlay_segments(fline): + # Opaque row backdrop to distinguish firehose from ticker beneath it. + buf.append(f"\033[{scr_row};1H{FIREHOSE_BG}{' ' * w}{RST}") + for col, chunk in _overlay_segments(fline, FIREHOSE_BG): buf.append(f"\033[{scr_row};{col}H{chunk}") sys.stdout.buffer.write("".join(buf).encode())