ccstatusline
ccstatusline copied to clipboard
feat: dynamic color thresholds for context percentage widgets
Summary
- Context percentage widgets now change color dynamically based on usage level
- Yellow at warning threshold, red at danger threshold
- Configurable presets via
tkeybind in TUI editor: default (50/75%), conservative (30/60%), aggressive (70/90%), off - Works on both
Context %andContext % (usable)widgets - Thresholds based on actual usage, not display value (works correctly with inverse/remaining mode)
Implementation
- New
getEffectiveColor()optional method on Widget interface - Renderer checks
getEffectiveColorbefore falling back to staticitem.color - Shared threshold logic in
src/utils/color-thresholds.ts - Threshold config stored in widget metadata (no schema changes needed)
Test plan
- [x] 99 tests passing (47 new), covering:
- Threshold color helper: all presets, boundaries, edge cases (0%, 100%)
- Both widgets: getEffectiveColor at each threshold level
- Preset cycling via handleEditorAction
- Editor display labels
- Inverse mode uses usage % not display %
- Usable widget uses usableTokens (160k) not maxTokens (200k)
- [x] TypeScript type check passes
- [x] Build passes
@sirmalloc check it please mate, because it will be cool to setup different colors for different context levels :)
Any plans to merge this @sirmalloc ?