Skip to content

feat: budget-aware coloring for the Extra Usage widgets #467

Description

@zachthedev

Problem

The Extra Usage widgets (extra-usage-used / -remaining / -utilization) render in one static configured color, so there is no visual cue as you approach your monthly spend limit. ccstatusline has no value-based coloring today (only custom-command + preserveColors).

Proposal

Add an optional Widget hook getDynamicColor(item, context): string | undefined. The renderer prefers it over item.color ?? getDefaultColor() at the per-widget foreground resolution (both the normal and powerline paths). overrideForegroundColor still wins, so precedence is unchanged, and widgets that do not implement it are unaffected.

The three Extra Usage widgets implement it: keyed on utilization (used / limit), they shift green -> yellow -> red as the budget nears exhaustion. Opt-in via a budgetColors metadata flag (default off = today''s static color). Thresholds default to 75% (warn) / 90% (critical); the three colors default to plain green/yellow/red and are overridable per-widget via metadata hexes.

Default behavior unchanged

Without the opt-in flag, every widget renders exactly as it does now.

PR incoming; happy to split it (interface + renderer hook, then the widget implementations) if you would rather review in pieces.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions