←
TRCKR-95
Created: 2025-12-08
•
Updated: 2025-12-16
Relationships
Loading...
Attachments
Loading...
Comments (1)
agent
·
2025-12-08
Successfully consolidated all color mappings into constants.
**What was changed:**
1. **tui/constants.py** - Added four color constant dictionaries:
- STATUS_COLORS (issue statuses: triage, todo, in-progress, blocked, in-review, done, archived)
- PRIORITY_COLORS (issue priorities: low, medium, high, urgent)
- PROJECT_STATUS_COLORS (project statuses: triage, active, on-hold, complete, archived)
- MILESTONE_STATUS_COLORS (milestone statuses: planned, in-progress, complete, archived)
2. **tui/formatting.py** - Added colorize_text(text, color) helper function:
- Simple wrapper around Text(text, style=color)
- Imported all four color constants
3. **tui/app.py** - Refactored colorize methods to use constants:
- _colorize_priority(): Removed inline dict, now uses PRIORITY_COLORS
- _colorize_issue_status(): Removed inline dict, now uses STATUS_COLORS
- _colorize_project_status(): Removed inline dict, now uses PROJECT_STATUS_COLORS
- _colorize_milestone_status(): Removed inline dict, now uses MILESTONE_STATUS_COLORS
- All methods now use colorize_text() helper
4. **tui/screens/edit.py** - Removed duplicate inline dictionaries:
- IssueEditScreen: Status and priority RadioButton colors now use STATUS_COLORS and PRIORITY_COLORS
- ProjectEditScreen: Status RadioButton colors now use PROJECT_STATUS_COLORS
- MilestoneEditScreen: Status RadioButton colors now use MILESTONE_STATUS_COLORS
**Test results:**
All 832 tests passed with no failures.
**Impact:**
- Reduced code by ~100 lines (68 deletions, 65 additions = net -3, but consolidated from multiple duplicates)
- Eliminated duplicate color definitions across 3 files
- Single source of truth for all color mappings
- Easier to maintain and update colors consistently
**Commit:** cb8ca93 (feature branch), e796874 (merged to master)