feat: update scroll.py to use theme message gradient

Add msg_gradient() helper function to render.py that applies message
(ntfy) gradient using the active theme's message_gradient property.
This replaces hardcoded magenta gradient in scroll.py with a theme-aware
approach that uses complementary colors from the active theme.

- Add msg_gradient(rows, offset) helper in render.py with fallback to
  default magenta gradient when no theme is active
- Update scroll.py imports to use msg_gradient instead of
  lr_gradient_opposite
- Replace lr_gradient_opposite() call with msg_gradient() in message
  overlay rendering
- Add 6 comprehensive tests for msg_gradient covering theme usage,
  fallback behavior, and edge cases

All tests pass (121 passed), no regressions detected.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-03-16 02:55:17 -07:00
parent d67423fe4c
commit 84cb16d463
3 changed files with 152 additions and 2 deletions

View File

@@ -18,7 +18,7 @@ from engine.effects import (
noise,
vis_trunc,
)
from engine.render import big_wrap, lr_gradient, lr_gradient_opposite, make_block
from engine.render import big_wrap, lr_gradient, msg_gradient, make_block
from engine.terminal import CLR, RST, W_COOL, th, tw
@@ -86,7 +86,7 @@ def stream(items, ntfy_poller, mic_monitor):
_msg_cache = (cache_key, msg_rows)
else:
msg_rows = _msg_cache[1]
msg_rows = lr_gradient_opposite(
msg_rows = msg_gradient(
msg_rows, (time.monotonic() * config.GRAD_SPEED) % 1.0
)
# Layout: rendered text + meta + border