Skip to content

fix(tui): stop the permission card's interior clashing on cool themes - #778

Merged
gnanam1990 merged 1 commit into
mainfrom
fix-permission-selected-row
Jul 20, 2026
Merged

fix(tui): stop the permission card's interior clashing on cool themes#778
gnanam1990 merged 1 commit into
mainfrom
fix-permission-selected-row

Conversation

@gnanam1990

@gnanam1990 gnanam1990 commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

The problem

The focused permission prompt was the only prompt card in the TUI that used brand/warning colours for its interior, and both read badly on cool themes such as dracula — a warm brown-yellow box over a purple palette:

  1. The selected option was painted with the brand chip. renderFocusedPermissionPrompt filled the highlighted row ("Yes, proceed") with zeroTheme.badge — the style behind the short brand chips (0, ASK, SPEC REVIEW), a full-brightness accent fill. Every other selectable list in the TUI highlights its selected row with onSel/selBg (provider_wizard.go, provider_manager.go, the / palette). The permission card was the outlier, and it was also the one line in the card that skipped the interior fill() every other line composed onto.

  2. The card body was tinted with permBg. An amber-family wash meant to signal a warning surface. It suits the warm default palette, but on cool themes it renders as a brown-yellow slab, and it made the permission card the only prompt whose body carries a fill at all — ask_user, spec review and plan all use a transparent body (lipgloss.NewStyle()).

The fix

Make the card's interior match the rest of the TUI, and let the warning identity come from the frame rather than the fill:

  • Selected rowonSel(ink), the same muted selection tint every other picker uses.
  • Card body → transparent, matching ask_user / spec / plan.
  • Unchanged: the amber PERMISSION badge and the amber-mixed border still mark it as a permission gate. Only the two clashing interior fills go.

Measured before/after in the dracula palette, at the "Yes, proceed" row and the body:

element before after
selected row bg #bd93f9 (bright brand accent) #504482 (selBg, muted)
card body bg #322a1e (permBg, warm slab) transparent
PERMISSION badge #ffb86c amber #ffb86c amber (unchanged)

The same relative change holds on the warm default palette (#caff3f#32401b for the row, #1c1915 → transparent for the body); it is simply less noticeable there because the warm fills already matched that theme.

Verification

TestFocusedPermissionSelectedRowUsesSelectionTintNotBrandChip asserts against palette entries, not hardcoded hex, so it survives a theme retune: the selected row must carry selBg and not the brand accent, the body must carry no permBg wash, and the PERMISSION badge must keep its amber fill so the card still reads as a warning surface.

Mutation-tested both halves: restoring zeroTheme.badge fails with "selected row is filled with the brand accent"; restoring the permBg body fill fails with "permission card body still tinted with permBg… want a transparent body".

gofmt and go vet ./internal/tui/ clean. Full internal/tui suite has the same single failure as main (TestHandleAddDirCommand, a pre-existing sandbox/TMPDIR artifact) — no new failures.

Summary by CodeRabbit

  • Bug Fixes
    • Updated the focused permission prompt so the selected option uses the standard selection highlight.
    • Preserved the permission indicator’s amber styling while removing the previous warm background tint from the dialog.
    • Improved visual consistency between selected permission options and other selectable rows.

The focused permission prompt was the only prompt card in the TUI that used
brand/warning colours for its interior, and both read badly on cool themes such
as dracula:

1. The selected option ("Yes, proceed") was filled with zeroTheme.badge — the
   brand chip meant for short labels (" 0 ", " ASK ", " SPEC REVIEW "), a
   full-brightness accent fill. Every other selectable list in the TUI (model
   picker, provider list, / palette) highlights its selected row with onSel/selBg
   instead. The permission card was the outlier, painting a saturated accent slab
   across the row and skipping the card tint every other line composed onto.

2. The card BODY was tinted with permBg, an amber-family wash intended to signal
   a warning surface. It works on the warm default palette but renders as a
   brown-yellow slab over cool themes, and it made the permission card the only
   prompt whose body carries a fill — ask_user, spec review and plan all use a
   transparent body (lipgloss.NewStyle()).

Fix both to match the rest of the TUI: the selected row uses onSel(ink) like
every other picker, and the body drops its permBg fill for a transparent one.
Warning identity is unchanged — the amber PERMISSION badge and the amber-mixed
border still mark it as a permission gate; only the clashing interior fills go.

TestFocusedPermissionSelectedRowUsesSelectionTintNotBrandChip asserts against
palette entries (not hardcoded hex, so it survives a theme retune): the selected
row carries selBg and not the brand accent, the body carries no permBg wash, and
the PERMISSION badge keeps its amber fill so the card still reads as a warning.
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 40af2f7c-949f-4496-a559-c5764209a05d

📥 Commits

Reviewing files that changed from the base of the PR and between a21a052 and a1bc1c4.

📒 Files selected for processing (2)
  • internal/tui/permission_prompt_test.go
  • internal/tui/rendering.go

Walkthrough

The focused permission prompt now highlights the selected option with the selection-row tint, preserves the amber permission badge, and removes the amber card-body background wash. A regression test validates the rendered ANSI background colors.

Changes

Permission prompt styling

Layer / File(s) Summary
Update permission prompt rendering
internal/tui/rendering.go
The selected option label uses the selection palette with bold text, the cursor marker remains accent-colored, and the permission card body no longer receives the permBg tint.
Verify rendered color behavior
internal/tui/permission_prompt_test.go
Adds coverage that checks the selected row, permission badge, and card body use the expected ANSI background colors.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • Gitlawb/zero#232: Updates focused permission popup cursor and row rendering in the same TUI code.

Suggested reviewers: vasanthdev2004

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the PR’s main change: adjusting the permission card styling to avoid color clashes on cool themes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-permission-selected-row

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

Zero automated PR review

Verdict: No blockers found

Blockers

  • None found.

Validation

  • [pass] Diff hygiene: git diff --check
  • [pass] Tests: go test ./...
  • [pass] Build: go run ./cmd/zero-release build
  • [pass] Smoke build: go run ./cmd/zero-release smoke

Scope

Head: a1bc1c4af26b
Changed files (2): internal/tui/permission_prompt_test.go, internal/tui/rendering.go

This deterministic review checks validation status and basic diff hygiene. A human reviewer still owns product judgment and design quality.

@anandh8x anandh8x left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. The focused permission card now uses the shared selected-row tint while retaining the permission badge and border as the warning signal. Focused TUI coverage and CI pass.

@Vasanthdev2004 Vasanthdev2004 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve. Tightly scoped fix, and the focused permission card really was the odd one out: it washed its whole body with permBg and filled the selected row with the brand badge, so it clashed on cool themes like dracula. Dropping the body wash and switching the selected row to the standard onSel(ink) tint brings it in line with the other prompt cards and the wizard/palette lists, while the amber PERMISSION badge and border keep the "this is a gate" signal.

Checked on head a1bc1c4:

  • Built and ran internal/tui. The new TestFocusedPermissionSelectedRowUsesSelectionTintNotBrandChip passes and is a genuine regression guard: it pins the selected row to selBg (not accent), keeps the amber badge, and asserts the body no longer carries permBg. Reverting either half of the change trips it.
  • The ink-on-selBg selected label stays readable on every theme: theme_select_test.go already asserts wcagRatio(ink, selBg) >= 4.5 per palette, so moving off the accent fill costs no contrast.
  • go vet and gofmt clean. Heads up if you run internal/tui locally: TestHandleAddDirCommand and TestAltScreenTranscriptScrollKeepsFooterFixed can fail, but they are pre-existing and environment-sensitive (they trip on plain main too) and unrelated to this diff. CI is green on all three OSes.

One non-blocking nit for a later sweep, not this PR: removing the two call sites leaves a few theme symbols with no reader left, namely the onPerm method, the resolved bgPerm color, and the resolved permBg style field. The permBg palette string stays live because the amber-on-permBg WCAG test still reads it, though that assertion is now vestigial since nothing paints on permBg anymore. go vet does not flag unused methods or fields so CI stays green; just flagging it for tidy-up.

LGTM.

@gnanam1990
gnanam1990 merged commit 722bb31 into main Jul 20, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants