Skip to content

Sidebar badge text invisible when theme uses transparent background #142

Description

@GavinSun0921

Problem

The sidebar header badge renders text using fg={theme.background}:

<box backgroundColor={props.theme.accent}>
  <text fg={props.theme.background}>
    <b>AFT</b>
  </text>
</box>

(Source: src/tui/sidebar.tsx, line ~605)

When the user's theme sets background: "none" (transparent — the documented way to respect terminal transparency, per https://opencode.ai/docs/themes/#terminal-defaults), theme.background resolves to RGBA(0,0,0,0). The badge text becomes fully transparent and invisible.

This makes transparent themes — including the built-in system theme when the terminal has a custom background — effectively unusable with the plugin sidebar.

The same issue exists in the magic-context plugin (src/tui/slots/sidebar-content.tsx, line ~693), which uses the identical pattern.

Environment

  • Plugin version: 0.40.1
  • OpenCode: 1.17.9
  • Terminal: iTerm2 with transparency enabled
  • Theme: custom theme with "background": "none"

Expected behavior

Badge text should remain visible regardless of whether theme.background is transparent.

Suggested fix

Use a high-contrast color for badge text instead of theme.background. For example:

<text fg={theme.text}>

Or compute a contrasting color from theme.accent (the badge background), similar to how opencode's selectedForeground() handles transparent backgrounds in packages/tui/src/theme/index.ts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions