Skip to content

Fix pane background alpha stacking with translucent themes#30

Open
EduardoBautista wants to merge 1 commit intomanaflow-ai:mainfrom
EduardoBautista:fix-pane-background-alpha-stacking
Open

Fix pane background alpha stacking with translucent themes#30
EduardoBautista wants to merge 1 commit intomanaflow-ai:mainfrom
EduardoBautista:fix-pane-background-alpha-stacking

Conversation

@EduardoBautista
Copy link

@EduardoBautista EduardoBautista commented Mar 17, 2026

Summary

  • Return .clear from paneBackground() / nsColorPaneBackground() when the resolved chrome color has alpha < 1.0
  • Prevents alpha stacking where two translucent layers (Ghostty renderer + Bonsplit pane background) combine to appear nearly opaque (e.g. two layers at 0.9 → 0.99)
  • Matches the existing pattern in GhosttyTerminalView.panelBackgroundFillColor()
  • Fixes transparency being ignored when using more than one pane in a workspace

Context

PR #29 fixed intermediate split wrapper/container layers but SplitViewContainer still applies .background(TabBarColors.paneBackground(...)) at the root, which paints a duplicate translucent layer.

Test plan

  • With background-opacity = 0.9: single pane should be visibly transparent
  • Split into 2+ panes: transparency maintained in all panes
  • With background-opacity = 1.0 (or unset): solid background, no regression

Summary by cubic

Fixes pane background alpha stacking with translucent themes so transparency looks correct in split panes. If the resolved chrome background is translucent, we stop drawing a second translucent layer.

  • Bug Fixes
    • TabBarColors.paneBackground(...) and nsColorPaneBackground(...) return .clear when alphaComponent < 0.999.
    • Prevents compounding translucency (e.g., 0.9 + 0.9 → ~0.99) from the renderer and pane background.
    • Keeps solid backgrounds unchanged and matches GhosttyTerminalView.panelBackgroundFillColor().

Written for commit ac2ea07. Summary will update on new commits.

Summary by CodeRabbit

Bug Fixes

  • Fixed background color rendering in the tab bar to prevent unintended translucency stacking when using background opacity settings.

paneBackground() returns the chrome background color with alpha baked
in. When Ghostty's background-opacity is < 1.0, the terminal renderer
already draws a translucent background. Painting another translucent
layer here causes alpha stacking (two layers at 0.9 combine to 0.99),
making the result appear nearly opaque.

Return .clear when the resolved color has alpha < 1.0, matching the
existing pattern in GhosttyTerminalView.panelBackgroundFillColor().
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@coderabbitai
Copy link

coderabbitai bot commented Mar 17, 2026

📝 Walkthrough

Walkthrough

The change modifies tab bar color computation to prevent double alpha compositing when translucent backgrounds are in use. Both SwiftUI Color and AppKit NSColor variants now check the alpha component and return clear if it's below 0.999, otherwise returning the computed color.

Changes

Cohort / File(s) Summary
Tab Bar Color Alpha Handling
Sources/Bonsplit/Internal/Styling/TabBarColors.swift
Added alpha component checks to paneBackground(for:) and nsColorPaneBackground(for:) methods to return Color.clear/.clear when alpha is less than 0.999, preventing translucent color layering.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • PR #29: Complements this change by clearing split wrapper layer backgrounds and consuming TabBarColors.paneBackground(for:) to prevent double alpha compositing in the visual hierarchy.

Poem

🐰 A layer too thick, a ghost in the glass,
Two alphas collide where one should pass.
Clear wins the day when opacity hides—
Now panes breathe softly on both sides.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix pane background alpha stacking with translucent themes' accurately and clearly describes the main change: fixing alpha stacking issues in pane backgrounds when using translucent themes, which is the core focus of the PR.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Tip

CodeRabbit can enforce grammar and style rules using `languagetool`.

Configure the reviews.tools.languagetool setting to enable/disable rules and categories. Refer to the LanguageTool Community to learn more.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file


Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Add one-off context when rerunning by tagging @cubic-dev-ai with guidance or docs links (including llms.txt)
  • Ask questions if you need clarification on any suggestion

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.

1 participant