mirror of
https://github.com/tiennm99/claude-code-usage-bubble.git
synced 2026-10-13 12:14:19 +00:00
fix(bubble): provider-tinted bar fill, tighten countdown gap
Two visible regressions from the previous pass:
1. Codex bars still rendered orange even though the accent stripe was
white — `ring_color_for_percent` only knew the percentage, not the
provider, so it returned the Claude-style orange/amber/red ramp for
both models. Replaced with `bar_fill_color(model, is_dark, pct)`:
- <60% → accent_color_for(model, is_dark) (Claude orange / Codex
white-on-dark / Codex charcoal-on-light)
- 60-80% → amber (#E0A040)
- 80-95% → red (#C45020)
- ≥95% → deep red (#A01818)
Alarm bands stay model-agnostic so an approaching limit always looks
the same. The "safe" band carries the provider's identity. Mirrored
into the panel via `bar_color_for(model, percent, is_dark)`.
2. Big visible gap between bar end and countdown text — the column
was sized for the old combined "100% · 23h" probe string (~9 chars)
but the bubble now renders countdown-only (~3 chars). Probe template
shrunk to "999d" so the right column is no longer ~70 px reserved
for ~14 px of text. Countdown also flipped from DT_RIGHT to DT_LEFT
so "3h" / "19h" sit immediately next to the bar with just the
`label_pad` gap, instead of floating at the bubble's far edge.
Inline-percent contrast calc uses `bar_fill_color` so the
luminance-based foreground colour responds to the new white/charcoal
Codex bars (black-on-white in safe band, white-on-amber/red in alarm).
Side effect: `ring_color_for_percent` is gone — it had no internal
callers outside the two replaced sites. `bar_fill_color` is now the
only public bar-color helper.
This commit is contained in:
1 parent
be8efef068
commit
6f5fb3fc80
2 files changed
+31
-22
No files matched your search
+3
-3
@@ -269,7 +269,7 @@ fn paint(hwnd: HWND, hdc: HDC) {
|
||||
} else {
|
||||
Color::from_hex("#D6D6D6")
|
||||
};
|
||||
let accent = bar_color_for(data.session_pct.max(data.weekly_pct), data.is_dark);
|
||||
let accent = bar_color_for(data.model, data.session_pct.max(data.weekly_pct), data.is_dark);
|
||||
|
||||
unsafe {
|
||||
let bg_brush = CreateSolidBrush(COLORREF(bg.into_colorref()));
|
||||
@@ -482,8 +482,8 @@ fn draw_text(
|
||||
}
|
||||
}
|
||||
|
||||
fn bar_color_for(percent: f64, _is_dark: bool) -> Color {
|
||||
crate::bubble::ring_color_for_percent(percent)
|
||||
fn bar_color_for(model: ProviderId, percent: f64, is_dark: bool) -> Color {
|
||||
crate::bubble::bar_fill_color(model, is_dark, percent)
|
||||
}
|
||||
|
||||
fn clone_data() -> Option<PanelData> {
|
||||
|
||||
Reference in new issue
Block a user