fix(tui): SSH-safe color fallbacks with ANSI-16 support #136

Merged
lerko merged 3 commits from fix/ssh-color-degradation into main 2026-06-19 21:33:41 +00:00
Owner

Summary

  • Migrate all theme colors from lipgloss.Color (hex-only) to lipgloss.CompleteColor with hand-picked ANSI-16 fallbacks
  • Add Bold/Faint emphasis attributes following htop's monochrome design principle
  • Fix Subtle visibility: ANSI "8" (bright black) + Faint was invisible, bumped to "7" (white)

Problem

Over SSH with 16-color terminals, lipgloss auto-degrades hex colors algorithmically. Dark backgrounds like #1C1B1A and #222120 collapse to the same ANSI color, making panel boundaries, zebra striping, and selection bars invisible.

Approach

  • lipgloss.CompleteColor with three tiers: TrueColor (existing hex), ANSI256 (same hex, auto-converted), ANSI (hand-picked 16-color indices)
  • Backgrounds (Bg/Surface/Panel/ZebraBg) fall through to terminal default in 16-color mode
  • Selection bar uses blue ("4") background for clear visibility
  • 4-tier emphasis hierarchy: Bold (danger/warn) > Normal (success/default) > Faint (subtle/stale/borders)
  • TrueColor rendering unchanged — no visual regression

Test plan

  • go build ./... passes
  • go test ./internal/tui/... passes
  • Lint clean
  • VHS color swatch comparison across all 3 profiles (TrueColor, ANSI-256, ANSI-16)
  • All 5 themes verified identical in ANSI-16 (shared mapping)
  • Manual SSH testing
## Summary - Migrate all theme colors from `lipgloss.Color` (hex-only) to `lipgloss.CompleteColor` with hand-picked ANSI-16 fallbacks - Add Bold/Faint emphasis attributes following htop's monochrome design principle - Fix Subtle visibility: ANSI "8" (bright black) + Faint was invisible, bumped to "7" (white) ## Problem Over SSH with 16-color terminals, lipgloss auto-degrades hex colors algorithmically. Dark backgrounds like `#1C1B1A` and `#222120` collapse to the same ANSI color, making panel boundaries, zebra striping, and selection bars invisible. ## Approach - `lipgloss.CompleteColor` with three tiers: TrueColor (existing hex), ANSI256 (same hex, auto-converted), ANSI (hand-picked 16-color indices) - Backgrounds (Bg/Surface/Panel/ZebraBg) fall through to terminal default in 16-color mode - Selection bar uses blue ("4") background for clear visibility - 4-tier emphasis hierarchy: Bold (danger/warn) > Normal (success/default) > Faint (subtle/stale/borders) - TrueColor rendering unchanged — no visual regression ## Test plan - [x] `go build ./...` passes - [x] `go test ./internal/tui/...` passes - [x] Lint clean - [x] VHS color swatch comparison across all 3 profiles (TrueColor, ANSI-256, ANSI-16) - [x] All 5 themes verified identical in ANSI-16 (shared mapping) - [x] Manual SSH testing
lerko added 3 commits 2026-06-19 21:28:07 +00:00
Theme colors now use lipgloss.CompleteColor with hand-picked ANSI-16
values instead of raw hex. Prevents algorithmic degradation from
collapsing dark backgrounds into indistinguishable ANSI colors over
SSH. Backgrounds fall through to terminal default in 16-color mode;
semantic colors map to distinct ANSI indices (green/yellow/red/blue/
cyan/magenta). TrueColor rendering is unchanged.
Apply Bold/Faint attributes to semantic styles following htop's
monochrome design principle. Creates 4-tier visual hierarchy that
works even when colors collapse: Bold (danger/warn), Normal (success/
default), Faint (subtle/stale/borders/inactive tabs). Complements
the ANSI-16 color fallbacks without affecting TrueColor appearance.
fix(tui): bump Subtle ANSI fallback from "8" to "7"
CI / test (pull_request) Successful in 1m49s
CI / lint (pull_request) Successful in 1m12s
CI / vulncheck (pull_request) Successful in 56s
47d3b0e68f
Bright black ("8") plus Faint made PENDING status and dividers nearly
invisible in 16-color terminals. White ("7") with Faint renders as a
readable dim gray while still sitting below Muted in the hierarchy.
lerko force-pushed fix/ssh-color-degradation from 00a99a3d77 to 47d3b0e68f 2026-06-19 21:28:07 +00:00 Compare
lerko merged commit 47d3b0e68f into main 2026-06-19 21:33:41 +00:00
lerko deleted branch fix/ssh-color-degradation 2026-06-19 21:33:41 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: lerkolabs/uptop#136