Terminal: resolve the ANSI palette per appearance - #20
Merged
Conversation
…hrome The dynamic light/dark switch landed with the terminal left out. Its panel chrome read the theme, but the grid painted from two constants: a hardcoded #090909 background and one ANSI table tuned by eye against it. In light mode that gave a near-black rectangle inside a white app, and the "bright" half of the palette — the half most CLI output uses — rendered pale-on-pale. The background and the 16 named slots now resolve through Appearance. The light table walks the same hue families down to the 600/700 steps, the way Theme::light does for its accents, and keeps "bright" meaning *more prominent* — which on a light field is darker, not lighter. Yellow needed amber-700 rather than yellow-600: it is the one hue whose 600 step still misses AA on white, and the theme's own warning token made the same move. The 6x6x6 cube stays appearance-independent, because index 196 is a program asking for #ff0000 by arithmetic and remapping it would invent colors nobody picked. The 232-255 grayscale ramp does mirror: tools reach for it to de-emphasize, and its bright end — where dim hint text lands — is exactly what disappears on white. Tests assert the contrast floor per slot on its own background, which is what would have caught this originally, plus the bright-is-more-prominent relation in both directions. Both carry the black/bright-black pair as a documented exception: those are structural greys, and the shipped dark tuning puts bright-black at 2.58:1. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This was referenced Aug 5, 2026
wingleeio
approved these changes
Aug 6, 2026
wingleeio
left a comment
Contributor
There was a problem hiding this comment.
Reviewed the diff and verified locally: single-file UI change (color tables + tests), no I/O/unsafe/dependency changes. Merged onto current main: 362/362 tests pass, fmt clean, zero clippy warnings in the changed file. Cube indices stay appearance-independent as described; grayscale mirror is exact. Safe to merge.
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.
The dynamic light/dark switch themed the terminal's chrome but not its grid. The panel read
Theme, while the cells painted from two constants: a hardcoded#090909background and a single ANSI table tuned by eye against it.In light mode that renders a near-black rectangle inside a white app, and the "bright" half of the palette — the half most CLI output reaches for — comes out pale-on-pale.
What changed
crates/ui/src/terminal/view.rs. The background and the 16 named ANSI slots now resolve throughAppearance:#090909dark,#fafafalight. The light step is larger than dark's 3/255 for the same reasonTheme::light's surfaces are: a delta that reads as separation on near-black disappears on white.Theme::lightalready does for its accents. "Bright" keeps meaning more prominent, which on a light field is darker. A literal copy of the dark table would have made the bright half the invisible half.#ff0000by arithmetic; remapping it would invent colors nobody picked. iTerm and Apple Terminal light themes do the same.One real finding while writing the tests: light yellow at yellow-600 measures 2.81:1 on the light background and misses AA. It moved to amber-700 — the step
Theme::lightalready picked for its ownwarningtoken, for the same reason.Tests
Five new, in the same module:
Both contrast tests carry the black / bright-black pair as a documented exception rather than skipping it silently: those are structural greys, and the shipped dark tuning puts bright-black at 2.58:1.
comet-uiis 362/362 green, clippy and fmt clean. Verified by eye in the running app in both appearances and across a live switch.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.