Skip to content

fix(ui-tui): a skin that authors a background owns its polarity - #69671

Merged
OutThisLife merged 1 commit into
mainfrom
bb/skin-owns-polarity
Jul 22, 2026
Merged

fix(ui-tui): a skin that authors a background owns its polarity#69671
OutThisLife merged 1 commit into
mainfrom
bb/skin-owns-polarity

Conversation

@OutThisLife

Copy link
Copy Markdown
Collaborator

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

fromSkin resolved polarity with detectLightMode() — the host terminal's polarity — even for skins that author their own background, 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:

Reproduced exactly:

TERM_PROGRAM=Apple_Terminal (no COLORTERM) + bloomberg skin
detectLightMode: true
text: ansi256(214)   muted: ansi256(245)   ← gray list markers visible, body invisible

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). fromSkin also 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 paired light_colors/dark_colors pick in themeForSkin follows the same rule.

With polarity corrected, text stays truecolor hex, so the OSC-10 default-foreground paint from #69632 engages as designed.

Tests

  • dark-background skin on light Apple Terminal keeps truecolor text (no ansi256 bucketing)
  • skin background outranks the cached host background for adaptation + tone derivation
  • skinIsLight decision table (authored bg decides; host only when absent)

ui-tui: 1347 passed, typecheck + lint clean.

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.
@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

running on e762ea1

CI timings

CI timings · View job

Wall time 7m50s vs 7m28s (+4.9%). 4 job(s) slower, 1 faster, 2 unchanged.

  • Build&Test Docker image / build (amd64, ubuntu-latest, linux/amd64, type=gha,scope=docker-amd64, type=gha,mode=max,scope=do...: +38.0s
  • Build&Test Docker image / build (arm64, ubuntu-24.04-arm, linux/arm64, type=gha,scope=docker-arm64, type=gha,mode=max,scope...: +12.0s
  • OSV scan / Scan lockfiles / osv-scan: -4.0s
  • OSV scan / Emit review status: +2.0s
  • Check uv.lock / uv lock --check: +1.0s

@OutThisLife
OutThisLife enabled auto-merge July 22, 2026 23:12
@OutThisLife
OutThisLife merged commit 8d6e045 into main Jul 22, 2026
27 checks passed
@OutThisLife
OutThisLife deleted the bb/skin-owns-polarity branch July 22, 2026 23:17
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/tui Terminal UI (ui-tui/ + tui_gateway/) labels Jul 22, 2026
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tui Terminal UI (ui-tui/ + tui_gateway/) P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants