Skip to content

feat: heat gauge colors for context percentage widget#179

Open
EthanJStark wants to merge 13 commits intosirmalloc:mainfrom
EthanJStark:feature/context-percentage-heat-gauge-colors
Open

feat: heat gauge colors for context percentage widget#179
EthanJStark wants to merge 13 commits intosirmalloc:mainfrom
EthanJStark:feature/context-percentage-heat-gauge-colors

Conversation

@EthanJStark
Copy link
Contributor

@EthanJStark EthanJStark commented Feb 18, 2026

What

Adds dynamic color coding to the context percentage widget, giving users an at-a-glance visual signal of how critical their context usage is — from calm cyan when usage is low, escalating through green → yellow → orange → red as context fills up.

Heat gauge visualization

Why

A bare percentage number requires active interpretation. Color makes the urgency of context usage immediately obvious without needing to read the number, which matters most when you're deep in a session.

Approach

  • Heat gauge color scale: Five-color spectrum (cyan / green / yellow / orange / red) mapped to percentage thresholds
  • Configurable thresholds: Power users can override the default breakpoints by adding a heatGaugeThresholds field to ~/.config/ccstatusline/settings.json. Zod validates that values are between 0–100 and strictly ascending (cool < warm < hot < veryHot).
  • Heat colors override widget-level colors: Since the color encodes semantic urgency (not user preference), it takes precedence over any widget color setting the user has configured
  • Opt-out toggle: Users who prefer a static color can disable heat gauge coloring per-widget via a new heatGaugeColors boolean field (defaults to true). Toggle via h in the TUI items editor.
  • Schema robustness: The model field in the status JSON can arrive as either a plain string or an object depending on the Claude Code version in use; both formats are now handled correctly across the schema and all widgets that read model info

Ethan Stark added 13 commits February 18, 2026 11:19
- Add is1MModel parameter to getHeatGaugeColor()
- Define conservative thresholds: 40%/55% for standard, 10%/15% for [1m]
- Add comprehensive test coverage for both model types
- Maintain backward compatibility (defaults to standard thresholds)
- Pass is1MModel flag to getHeatGaugeColor() based on context config
- [1m] models now use conservative 10%/15% thresholds
- Standard models use 40%/55% thresholds
- Add comprehensive tests for model-aware color application
- Add detailed JSDoc for getHeatGaugeColor function
- Document threshold rationale for both model types
- Explain why [1m] models need more conservative thresholds
- Add usage examples showing different model behaviors
- Document color selection from Tailwind CSS palette
- Add null assertions in ContextPercentage tests to satisfy TypeScript
- Remove unused @ts-expect-error directive in colors tests
- All tests passing, TypeScript compilation successful
- Add heatGaugeColors field to WidgetItemSchema (defaults to true)
- Add contextWindow field to RenderContext interface
- Port heat gauge color logic, toggle keybind, and editor display
  from ContextPercentage into ContextPercentageUsable
- Support custom thresholds from settings (standard/extended)
- Update tests: existing calculation tests use heatGaugeColors:false,
  new tests verify color on/off behavior
All models now use a single default threshold set (cool=30/warm=40/
hot=55/veryHot=70). Removes the compressed 1M-model thresholds that
were added when 1M context models were less performant.

- Remove `is1MModel` param from `getHeatGaugeColor`
- Flatten `settings.heatGaugeThresholds` from `{ standard?, extended? }`
  to a single optional `HeatGaugeThresholdSet` (power user customisation preserved)
- Remove model-detection branching from ContextPercentage and
  ContextPercentageUsable widgets
- Update tests to reflect simplified schema
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant