fix(ui-tui): a skin that authors a background owns its polarity - #69671
Merged
Conversation
The theme engine picked light/dark adaptation from the HOST terminal (detectLightMode) even when the skin authors its own background — which the TUI then paints onto the terminal via OSC-11. On a light-mode Apple Terminal without truecolor, a pure-black skin (e.g. Bloomberg) got its foregrounds ansi256-bucketed *for a light background that no longer exists*: theme.color.text became 'ansi256(214)', which also fails the OSC-10 hex gate, so the terminal default fg stayed the light profile's near-black — markdown body text rendered black-on-black. fromSkin now resolves polarity from the skin's authored background when present (skinIsLight), uses that background as the reference canvas for the derived tone ladder and contrast adaptation, and only falls back to host detection for skins without a background (they render on the terminal's own surface). The paired light_colors/dark_colors pick in themeForSkin follows the same rule.
Contributor
૮ >ﻌ< ა ci reviewrunning on e762ea1 CI timingsCI timings · View jobWall time 7m50s vs 7m28s (+4.9%). 4 job(s) slower, 1 faster, 2 unchanged.
|
OutThisLife
enabled auto-merge
July 22, 2026 23:12
randlee
pushed a commit
to randlee/hermes-agent
that referenced
this pull request
Aug 11, 2026
…polarity fix(ui-tui): a skin that authors a background owns its polarity
33hodl
pushed a commit
to 33hodl/hermes-agent
that referenced
this pull request
Aug 12, 2026
…polarity fix(ui-tui): a skin that authors a background owns its polarity
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.
Symptom
Bloomberg demo skin (pure black background, amber text) on light-mode Apple Terminal: agent/markdown body text invisible (black-on-black) while explicitly colored tokens (headers, list markers, status bar) stayed visible.
Root cause
fromSkinresolved polarity withdetectLightMode()— the host terminal's polarity — even for skins that author their ownbackground, which the TUI then paints onto the terminal (OSC-11). On light Apple Terminal without truecolor that triggered the light-terminal ANSI normalization pass over a skin whose canvas is black:theme.color.text→ansi256(214)— adapted for a light background the skin just painted overansi256(...)fails the OSC-10 hex gate from fix(ui-tui): a skin owns the terminal's DEFAULT foreground (OSC-10) — kills the invisible-text class #69632, so the terminal's default foreground was never repainted → stays the light profile's near-blackReproduced exactly:
Fix
A skin that authors a background owns its polarity. New
skinIsLight(): authored-background luminance decides light/dark; host detection only applies to skins without a background (they render on the terminal's own surface).fromSkinalso uses the authored background as the reference canvas for the derived tone ladder + contrast adaptation (previously it mixed fills against the cached HOST background — white — for a black-canvas skin). The pairedlight_colors/dark_colorspick inthemeForSkinfollows the same rule.With polarity corrected, text stays truecolor hex, so the OSC-10 default-foreground paint from #69632 engages as designed.
Tests
skinIsLightdecision table (authored bg decides; host only when absent)ui-tui: 1347 passed, typecheck + lint clean.