fix(bubble): codex accent → white, percent rides fill edge

Codex stripe is white in dark mode and charcoal (#2A2A2A) in light mode
— a pure white would vanish into the light-mode #F3F3F3 background, so
the light-mode variant keeps the same monochrome-vs-orange identity
without disappearing. Mirrored into the expanded panel.

Inline percent now anchors to the fill's trailing edge instead of the
bar's far-right. Two modes:

- Fill is wide enough (fill_w >= text_w + 2*inset): right-align the
  percent *inside* the fill at its trailing edge. Text sits on the
  fill colour.
- Fill is too narrow: left-align the percent just past the fill on
  the track. Text follows the fill's edge.

Previously the percent was always right-aligned to bar_right - inset,
which detached it from the fill at low percentages — e.g. at 42% the
"42%" floated near the bar's right end while the fill stopped at
~42% of bar width. Now the percent rides the fill so the visual
relationship between number and bar length is immediate.

Text width measured via GetTextExtentPoint32W against the currently
selected font so the anchoring decision uses the actual rendered
width, not a heuristic.
This commit is contained in:
tiennm99 committed 2026-05-16 11:39:15 +07:00
1 parent 5df75c901e
commit be8efef068
2 files changed
+52 -23

No files matched your search

+6 -4
View File
@@ -277,10 +277,12 @@ fn paint(hwnd: HWND, hdc: HDC) {
let _ = DeleteObject(bg_brush);
// 4-px accent stripe matching the bubble — same provider color so the
// identity carries across both surfaces.
let stripe_color = match data.model {
ProviderId::Claude => Color::from_hex("#D97757"),
ProviderId::ChatGpt => Color::from_hex("#10A37F"),
// identity carries across both surfaces. Codex is theme-aware so a
// pure white stripe doesn't vanish into the light-mode background.
let stripe_color = match (data.model, data.is_dark) {
(ProviderId::Claude, _) => Color::from_hex("#D97757"),
(ProviderId::ChatGpt, true) => Color::from_hex("#FFFFFF"),
(ProviderId::ChatGpt, false) => Color::from_hex("#2A2A2A"),
};
let stripe_w = scaled(4);
let stripe_rect = RECT {