Skip to content

fix(renderer): respect alpha channel for transparent background#478

Merged
kommander merged 1 commit intoanomalyco:mainfrom
Stranmor:fix/transparent-background-alpha-check
Jan 8, 2026
Merged

fix(renderer): respect alpha channel for transparent background#478
kommander merged 1 commit intoanomalyco:mainfrom
Stranmor:fix/transparent-background-alpha-check

Conversation

@Stranmor
Copy link
Contributor

@Stranmor Stranmor commented Jan 6, 2026

Summary

  • Fix transparent background not working when theme specifies "background": "none"
  • Check alpha channel before emitting ANSI RGB background escape codes

Problem

When backgroundColor has alpha = 0 (transparent), the renderer was still calling ANSI.setRgbBackground(), which overrides the terminal's native transparency settings with a solid color (typically black).

Solution

Added a simple alpha check before setting RGB background:

if (backgroundColor[3] === 0) {
  clear = newlines
} else {
  clear = ANSI.setRgbBackground(...) + newlines + ANSI.resetBackground
}

Test plan

  • Create custom theme with "background": { "dark": "none", "light": "none" }
  • Apply theme in opencode
  • Verify terminal's transparent background shows through

Tested with:

  • Terminal: Kitty (GPU-accelerated with transparency support)
  • OS: Arch Linux

🤖 Generated with Claude Code

When backgroundColor has alpha = 0, skip ANSI.setRgbBackground() call
to allow terminal's native transparency to show through.

Previously, the renderer would always emit RGB background escape codes
even when the theme specified a transparent background (alpha = 0),
overriding the terminal's transparency settings.

This enables custom themes with "background": "none" to properly
render with the terminal's transparent background.
@kommander kommander merged commit 940daa2 into anomalyco:main Jan 8, 2026
4 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.

2 participants