[PR #478] [MERGED] fix(renderer): respect alpha channel for transparent background #566

Closed
opened 2026-03-02 23:47:08 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opentui/pull/478
Author: @Stranmor
Created: 1/6/2026
Status: Merged
Merged: 1/8/2026
Merged by: @kommander

Base: mainHead: fix/transparent-background-alpha-check


📝 Commits (1)

  • bc8c91a fix(renderer): respect alpha channel for transparent background

📊 Changes

1 file changed (+9 additions, -4 deletions)

View changed files

📝 packages/core/src/renderer.ts (+9 -4)

📄 Description

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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opentui/pull/478 **Author:** [@Stranmor](https://github.com/Stranmor) **Created:** 1/6/2026 **Status:** ✅ Merged **Merged:** 1/8/2026 **Merged by:** [@kommander](https://github.com/kommander) **Base:** `main` ← **Head:** `fix/transparent-background-alpha-check` --- ### 📝 Commits (1) - [`bc8c91a`](https://github.com/anomalyco/opentui/commit/bc8c91a16590ece6379f52ce8e882728bea621fe) fix(renderer): respect alpha channel for transparent background ### 📊 Changes **1 file changed** (+9 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `packages/core/src/renderer.ts` (+9 -4) </details> ### 📄 Description ## 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: ```typescript if (backgroundColor[3] === 0) { clear = newlines } else { clear = ANSI.setRgbBackground(...) + newlines + ANSI.resetBackground } ``` ## Test plan - [x] Create custom theme with `"background": { "dark": "none", "light": "none" }` - [x] Apply theme in opencode - [x] Verify terminal's transparent background shows through Tested with: - Terminal: Kitty (GPU-accelerated with transparency support) - OS: Arch Linux 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-02 23:47:08 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/opentui#566
No description provided.