feat/color-pick #30

Merged
genewildish merged 12 commits from feat/color-pick into main 2026-03-16 10:13:48 +00:00
Owner

Summary

Implements interactive color theme selection for Mainline news ticker.

  • Three selectable color themes: Verdant Green, Molten Orange, Violet Purple
  • Interactive picker at startup (↑/↓ or j/k, Enter to select)
  • Complementary gradients for ntfy messages (magenta, blue, yellow)
  • Fresh theme selection each run (no persistence)
  • Non-TTY environments silently default to green

Test Plan

  • Run python3 mainline.py and select each theme (verify colors)
  • Run echo "" | python3 mainline.py (verify non-TTY fallback)
  • Run python3 mainline.py --poetry with orange (verify poetry mode)
  • Run python3 mainline.py --code with purple (verify code mode)
  • Run pytest tests/ -v (all 121 tests pass)

Architecture

  • New engine/themes.py: Theme class + registry (data-only, no circular deps)
  • Modified engine/config.py: ACTIVE_THEME global + setter
  • Modified engine/render.py: Theme-aware gradients with fallback
  • Modified engine/scroll.py: Message gradient integration
  • Modified engine/app.py: Interactive picker UI + startup integration
  • Updated README.md: Feature documentation
## Summary Implements interactive color theme selection for Mainline news ticker. - Three selectable color themes: Verdant Green, Molten Orange, Violet Purple - Interactive picker at startup (↑/↓ or j/k, Enter to select) - Complementary gradients for ntfy messages (magenta, blue, yellow) - Fresh theme selection each run (no persistence) - Non-TTY environments silently default to green ## Test Plan - [x] Run `python3 mainline.py` and select each theme (verify colors) - [x] Run `echo "" | python3 mainline.py` (verify non-TTY fallback) - [x] Run `python3 mainline.py --poetry` with orange (verify poetry mode) - [x] Run `python3 mainline.py --code` with purple (verify code mode) - [x] Run `pytest tests/ -v` (all 121 tests pass) ## Architecture - New `engine/themes.py`: Theme class + registry (data-only, no circular deps) - Modified `engine/config.py`: ACTIVE_THEME global + setter - Modified `engine/render.py`: Theme-aware gradients with fallback - Modified `engine/scroll.py`: Message gradient integration - Modified `engine/app.py`: Interactive picker UI + startup integration - Updated `README.md`: Feature documentation
genewildish added 11 commits 2026-03-16 10:07:31 +00:00
- Clarify boot messages use hardcoded green, not theme gradients
- Finalize all gradient ANSI color codes (no TBD)
- Add initialization guarantee for ACTIVE_THEME
- Resolve circular import risk with data-only themes.py
- Update theme ID naming to match menu labels
- Expand test strategy and mock approach
- Update opening description to mention selectable color gradients
- Add new 'Color Schemes' section with picker usage instructions
- Document three available themes (Green, Orange, Purple)
- Clarify that boot UI uses hardcoded green, not theme colors
Comprehensive plan with 6 chunks, each containing bite-sized TDD tasks:
- Chunk 1: Theme class and registry
- Chunk 2: Config integration
- Chunk 3: Render pipeline
- Chunk 4: Message gradient integration
- Chunk 5: Color picker UI
- Chunk 6: Integration and validation

Each step includes exact code, test commands, and expected output.
- Remove hardcoded GRAD_COLS and MSG_GRAD_COLS module constants
- Add _default_green_gradient() and _default_magenta_gradient() fallback functions
- Add _color_codes_to_ansi() to convert integer color codes from themes to ANSI escape strings
- Update lr_gradient() signature: cols parameter (was grad_cols)
- lr_gradient() now pulls colors from config.ACTIVE_THEME when available
- Falls back to default green gradient when no theme is active
- Existing calls with explicit cols parameter continue to work
- Add comprehensive tests for new functionality

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
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>
Organize imports in render.py and scroll.py to meet ruff style requirements.
Add blank lines for code formatting compliance.
genewildish added 1 commit 2026-03-16 10:13:21 +00:00
Resolved conflicts in tests/test_config.py by keeping TestActiveTheme tests.
Main branch has new architecture components (controller, events, layers, effects).
Color scheme feature preserved and compatible.
genewildish merged commit 001158214c into main 2026-03-16 10:13:48 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: genewildish/Mainline#30