Fix: make the per-turn token metric readable in every theme - #68
Merged
Merged
Conversation
The per-turn token count was --dim text, right-aligned. That put the smallest and palest element in the app in the exact corner where every themed overlay's vignette is darkest: 2.02:1 on Cathode Ray, 1.95:1 on Pheteven Phosphor, against a 4.5 floor. Raising the colour does not fix it. Full foreground still measured 3.79 and 2.77 on those two, because the vignette was strong enough to defeat any palette value. The distinction matters for the contrast floor added earlier: scanlines attenuate UNIFORMLY, so a raised floor answers them, but a vignette attenuates by position, so the same colour passes mid-pane and fails in the corner. There is no value to pick, and no palette-level rule that helps. So the metric gets a surface. On its own pill it carries its own background and border, reads as a deliberate element rather than trailing text, and survives a busy chat wallpaper — the reasoning the plan-activity card already uses. De-emphasis now comes from size and containment rather than faintness, which is the durable form: small and bounded stays legible under anything painted over it; faint stops being legible the moment something is. Deliberately NOT wrapped in chip-row, despite holding an ordinary chip: IsEphemeralStatus drops every chip-row from a restored session, on the grounds that status pills describe a dead process's live state. A token count is the opposite — it is what that turn cost, and it belongs to history. Reusing that class would have silently deleted these from every reopened session. The vignettes were also simply too strong, tuned by eye against body text which has enormous headroom, and were eating everything fainter — including ordinary text at the pane edges. Eased across all four overlaid themes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The token count shown after each turn was effectively invisible in several themes. It now sits in a small pill with its own background rather than being faint text at the edge of the pane, and the corner shading on the themes that imitate a screen has been eased.
What was happening
The metric was drawn as pale text, right-aligned. That combination put the smallest and palest element in the application in the exact spot where the themes that imitate a display are darkest — the shading around the edge of a simulated screen.
Measured against the contrast the text needed, it was reaching well under half of it. On the CRT and amber terminal themes it was worse than a 2:1 ratio, which in practice means it was not readable at all. On the vacuum-fluorescent, vector scope, microfiche and LCD themes it was better but still short.
Worth recording for anyone who revisits this: raising the text's colour would not have fixed it. Even at full brightness the metric still failed on two themes, because the corner shading was strong enough to defeat any colour the palette could offer.
That points at a real distinction. An earlier change added a contrast floor for themes viewed through an overlay, and that works for the CRT's scanlines, which dim the whole pane evenly. Corner shading is not even — it varies by position, so the very same colour is comfortably readable in the middle of the window and unreadable near the edge. No palette-level rule can answer that.
What changed
Scope and risk
Low, and limited to the transcript's appearance. No change to what the metric reports, when it appears, or how it is calculated.
One thing a reviewer should be aware of: the pill is deliberately not wrapped in the container class used by the existing status pills. That class is filtered out when a saved session is reopened, on the grounds that status pills describe the live state of a process that has since ended. A token count is the opposite — it is what that turn actually cost, and it belongs to the conversation's history. Reusing that class would have silently removed these from every restored session. There is a comment at the call site recording this, since the two are otherwise near-identical and the trap is easy to walk into again.
Verification
Builds clean, 0 warnings and 0 errors. Full Desktop suite passes, 423 of 423 — unchanged, as this touches presentation only.
Contrast was measured numerically before and after for each affected theme, including compositing the corner shading over both the text and its background, which is what established that a colour change alone was insufficient.
Not covered by tests: the transcript renders in a WebView and is not reachable from the test project. A reviewer should look at Cathode Ray and Pheteven Phosphor, the two worst cases, and confirm the metric is legible in the bottom-right corner — and ideally with a chat background image set, since that is the other case the pill is meant to survive.