Skip to content

Conversation

@ariane-emory
Copy link
Contributor

@ariane-emory ariane-emory commented Nov 21, 2025

Resolves #4369.

This PR adds an optional 'selectedListItemText' theme colour field for better transparency support (i.e, when background colour = "none"). This provides a means by which users may avoid issue #4369.

Adds a new optional selectedListItemTextcolour property to the theme system that specifies the text color when displayed on a primary background (e.g., selected list items, active buttons).

If selectedListItemText is not present, a contrasting color (black or white) based on the luminance of theme is used (thanks to a branch from knanao I merged in).

Previously, selected items would use the background colour as text colour, making text invisible when background was transparent.

Changes:

  • Add selectedListItemText to Theme type and ThemeJson schema
  • Implement automatic fallback: if selectedListItemText is not defined in a theme,
    it defaults to the background colour, preserving current behaviour
  • Update all UI components that display text on primary backgrounds to
    use theme.selectedListItemText instead of theme.background
  • Add selectedListItemText to JSON schema as optional property

Backward compatibility:

  • All existing themes (built-in and custom) continue to work unchanged
  • No theme files require modification
  • Visual appearance remains identical for existing themes
  • Users can opt-in by adding primaryText to their custom themes

Components updated:

  • dialog-select.tsx: Selected list items (4 locations)
  • dialog-confirm.tsx: Active confirmation buttons (1 location)
  • dialog-help.tsx: OK button (1 location)
  • dialog-alert.tsx: OK button (1 location)
  • autocomplete.tsx: Selected autocomplete items (2 locations)

Example of usage in a custom theme:

{
  "background": "none",
  "primary": "#fab283",
  "selectedListItemText": "#0a0a0a"
}

Screenshot

Compare to the screenshot in issue #4369.

This screenshot shows the same theme but with "selectedListItemText": "#000", added, note that the text of the selected list item is now legible.

Screenshot 2025-11-21 at 2 21 28 AM

ariane-emory and others added 3 commits November 21, 2025 01:57
…xt' theme color for better transparency support (i.e, when background colour = none). Adds a new optional `primaryText` color property to the theme system that specifies the text color when displayed on a `primary` background (e.g., selected list items, active buttons).

This change solves the invisible text issue that occurs when users set `background: none` in custom themes to enable terminal transparency. Previously, selected items would use the background color as text color, making text invisible when background was transparent.
@ariane-emory ariane-emory marked this pull request as draft November 21, 2025 07:31
@ariane-emory ariane-emory changed the title feature: optional primaryText element in themes to provide a way to avoid issue 4369 feature: optional selectedListItemText element in themes to provide a way to avoid issue 4369 Nov 21, 2025
@ariane-emory ariane-emory marked this pull request as ready for review November 21, 2025 07:37
knanao and others added 2 commits November 21, 2025 17:00
…llback logic

Accepts knanao branch improvements for selected list item text color:
- Uses selectedForeground(theme) helper function for better logic
- Falls back to theme.background when selectedListItemText is not defined
- Resolves merge conflicts by keeping knanao implementation

This provides better handling of transparent backgrounds while maintaining backward compatibility.
@ariane-emory ariane-emory marked this pull request as draft November 21, 2025 08:33
@ariane-emory ariane-emory force-pushed the feature/explicit-selected-item-colours branch from 48144e6 to 23f082e Compare November 21, 2025 08:46
@ariane-emory ariane-emory changed the title feature: optional selectedListItemText element in themes to provide a way to avoid issue 4369 feature: optional selectedListItemText element in themes and luminance-based fallback to solve 4369 Nov 21, 2025
@ariane-emory ariane-emory marked this pull request as ready for review November 21, 2025 09:10
@ariane-emory
Copy link
Contributor Author

ariane-emory commented Nov 21, 2025

Merged in https://github.com/knanao/opencode/tree/fix/list-selection-fg.

If selectedListItemTextcolour is present in the theme, it is used.

Otherwise, knanao's luminance-based colour selection is used.

@knanao
Copy link
Contributor

knanao commented Nov 22, 2025

There is one known issue.
For users who want to make all backgrounds transparent, it may be inconvenient that the background color of the autocomplete command list can not be changed and is tied to backgroundElement.
Screenshot 2025-11-22 at 10 51 59

One option is to make this configurable, but implementing that within this PR feels a bit excessive.
It might be better to address it in a separate PR after this one is merged.

@ariane-emory
Copy link
Contributor Author

Sounds good to me! It looks great to me already, but I'll keep an eye on your branch in case you decide to tweak anything else.

@jensenojs
Copy link
Contributor

There is one known issue. For users who want to make all backgrounds transparent, it may be inconvenient that the background color of the autocomplete command list can not be changed and is tied to backgroundElement. Screenshot 2025-11-22 at 10 51 59

One option is to make this configurable, but implementing that within this PR feels a bit excessive. It might be better to address it in a separate PR after this one is merged.

I'm not sure if I've kept up with your discussion, but this is definitely a pain point.

If the relevant pull requests are merged here, I understand that the commits here should also be re-added (maybe the new pull requests could be adjusted together?). @rekram1-node

@jensenojs
Copy link
Contributor

There is one known issue.有一个已知的问题。 For users who want to make all backgrounds transparent, it may be inconvenient that the background color of the autocomplete command list can not be changed and is tied to backgroundElement.对于希望让所有背景透明的用户来说,自动补全命令列表的背景颜色无法更改且绑定在 backgroundElement 上可能会很不方便。 Screenshot 2025-11-22 at 10 51 59

One option is to make this configurable, but implementing that within this PR feels a bit excessive.一个选项是让它可配置,但在这个 PR 里实现感觉有点过头。 It might be better to address it in a separate PR after this one is merged.合并后,可能在另一个 PR 中处理会更好。

@knanao I'm pretty happy with how the PR looks now. and yes I do want as many boxes as possible to be transparent—if the behavior makes sense. That said, the behavior feels a bit odd? can you tell me what you think the expected behavior should be here?

image

@knanao
Copy link
Contributor

knanao commented Nov 22, 2025

@jensenojs
This occurs because the background of the prompt input(backgroundElement) and the autocomplete list are the same.
Initially, I considered calculating these colors as defaults from the configured theme, but since I thought the visibility and preference of these colors can vary depending on the user’s other settings, the background of the autocomplete list can be made optionally configurable as a workaround.

c107e3c is an example implementation of this approach.

{
...
  "theme": {
    "backgroundMenu": "#1c1c1c",
    ...
}
Screenshot 2025-11-22 at 21 04 52

Merges latest changes from knanao's branch which adds:
- backgroundMenu theme color for autocomplete list backgrounds
- Conditional border character based on background transparency
- Properly integrates with existing selectedListItemText handling

Resolved conflicts by:
- Keeping our _hasSelectedListItemText flag logic
- Adding backgroundMenu as optional in ThemeJson
- Adding backgroundMenu fallback to backgroundElement when not defined
- Maintaining type safety with proper Partial<ThemeColors> handling
@ariane-emory
Copy link
Contributor Author

Merged in knanao's latest changes.

@rekram1-node rekram1-node merged commit 7d11986 into sst:dev Nov 23, 2025
3 checks passed
@jensenojs
Copy link
Contributor

Hi, I'm encountering a problem regarding transparent themes.

A persistent black bar has started appearing above the status line (see screenshots). This setup worked perfectly in previous versions, but now this specific area remains opaque despite my theme config setting everything to transparent.

transparent.json

I've attached the "Before vs Now" screenshots and my theme.json for reproduction.

before

image

now

image

Could you please share a working theme.json reference that you use for full transparency?

@ariane-emory @knanao

@ariane-emory
Copy link
Contributor Author

Huh, what terminal is this in? I am not seeing it in iTerm2 on MacOS.

As requested, here is an example of a theme I currently use:

{
  "$schema": "https://opencode.ai/theme.json",
  "defs": {
    "dark_grey": "#27272a",
    "dark_fg": "#c9c7cd",
    "dark_gray00": "#18181a",
    "dark_gray01": "#1b1b1d",
    "dark_gray02": "#2a2a2d",
    "dark_gray05": "#757581",
    "dark_gray06": "#9998a8",
    "dark_gray07": "#c1c0d4",
    "dark_green": "#90b99f",
    "dark_purple": "#080010",
    "lavender": "#b9aeda",
    "lavenderish_pink": "#aca1cf",
    "medium_pink": "#ea83a5",
    "pale_green": "#9dc6ac",
    "pale_grey": "#c1c0d4",
    "light_orange": "#ffae9f",
    "pale_orange": "#f5a191",
    "pale_pink": "#e29eca",
    "pale_yellow": "#f0c5a9",
    "bright_yellow": "#dd0"
  },
  "theme": {
    "primary": "medium_pink",
    "secondary": "medium_pink",
    "accent": "lavenderish_pink",
    "error": "medium_pink",
    "warning": "pale_yellow",
    "success": "dark_green",
    "info": "lavenderish_pink",
    "text": "dark_fg",
    "textMuted": "pale_grey",
    "background": "none",
    "backgroundPanel": "dark_gray01",
    "backgroundElement": "dark_gray02",
    "border": "dark_gray02",
    "borderActive": "dark_gray01",
    "borderSubtle": "dark_gray00",
    "diffAdded": "dark_grey",
    "diffRemoved": "dark_grey",
    "diffContext": "dark_fg",
    "diffHunkHeader": "pale_pink",
    "diffHighlightAdded": "pale_green",
    "diffHighlightRemoved": "light_orange",
    "diffAddedBg": "dark_green",
    "diffRemovedBg": "pale_orange",
    "diffContextBg": "dark_gray00",
    "diffLineNumber": "diffContextBg",
    "diffAddedLineNumberBg": "dark_green",
    "diffRemovedLineNumberBg": "pale_orange",
    "markdownText": "dark_fg",
    "markdownHeading": "dark_gray06",
    "markdownLink": "lavenderish_pink",
    "markdownLinkText": "medium_pink",
    "markdownCode": "pale_green",
    "markdownBlockQuote": "dark_gray00",
    "markdownEmph": "pale_yellow",
    "markdownStrong": "light_orange",
    "markdownHorizontalRule": "markdownText",
    "markdownListItem": "lavenderish_pink",
    "markdownListEnumeration": "lavender",
    "markdownImage": "markdownLink",
    "markdownImageText": "markdownLinkText",
    "markdownCodeBlock": "dark_fg",
    "selectedListItemText": "dark_purple",
    "syntaxComment": "dark_gray05",
    "syntaxKeyword": "lavenderish_pink",
    "syntaxFunction": "dark_gray07",
    "syntaxVariable": "dark_fg",
    "syntaxString": "dark_green",
    "syntaxNumber": "pale_pink",
    "syntaxType": "pale_pink",
    "syntaxOperator": "pale_yellow",
    "syntaxPunctuation": "dark_gray06"
  }
}

@jensenojs
Copy link
Contributor

jensenojs commented Nov 23, 2025

Thanks! To answer your question, I'm using WezTerm.

I just loaded your ariane.json and it actually looks good on my setup

image

I'll stick with this theme as my daily driver for now. I might dig deeper into the code later to see if I can fix the transparency regression myself, but this is a great workaround. Thanks for sharing!


update :

image

seems fix now (

@knanao
Copy link
Contributor

knanao commented Nov 23, 2025

FYI
https://github.com/sst/opencode/pull/4574/commits/c107e3c376c23bfb812394ae1c0a9d3f5d41dcfc#r2553118965

shuv1337 pushed a commit to Latitudes-Dev/shuvcode that referenced this pull request Nov 24, 2025
…e-based fallback to solve 4369 (sst#4572)

Co-authored-by: knanao <[email protected]>
Co-authored-by: knanao <[email protected]>
shuv1337 added a commit to Latitudes-Dev/shuvcode that referenced this pull request Nov 24, 2025
* ci: fix action

* feature: optional selectedListItemText element in themes and luminance-based fallback to solve 4369 (sst#4572)

Co-authored-by: knanao <[email protected]>
Co-authored-by: knanao <[email protected]>

* ignore: update download stats 2025-11-23

* ignore: update @solidjs/start dependency and fix console redirect handling

Updates the @solidjs/start dependency to latest version and removes deprecated getResponseHeaders usage from auth callback. Also adds error handling for workspace ID lookup to prevent redirect failures.

* Update Nix flake.lock and hashes

* tweak: fix bool

* sync

* ci: stuff

* Update Nix flake.lock and hashes

* ci: stuff

* Update Nix flake.lock and hashes

* fix bash tool wsl

* ci: ignore

* release: v1.0.106

* Update Nix flake.lock and hashes

* ci: ignore

* token

* ci: secret

* chore: format code

* ci: ignore

* ci: ignore

* ci: ignore

* ci: remove log

* tweak: slight improvements to title gen

* wip: zen

* wip: zen

* chore: format code

* fix: add explicit fallback model and prevent direct opencode provider calls (sst#4653)

Co-authored-by: Aiden Cline <[email protected]>

* nix: bundle js dist with bun and patch tree-sitter wasm paths (sst#4644)

Co-authored-by: Aiden Cline <[email protected]>
Co-authored-by: Github Action <[email protected]>

* chore: format code

* fix: fatal: undefined is not an object (evaluating 'color.buffer')

* bump copilot plugin, give better error message for copilot (sst#4678)

* release: v1.0.107

* tweak: modified files sidebar

* fix: persist light vs dark mode

* chore: format code

* tweak: display MCPs in alphabetic order in the sidebar. (sst#4680)

Co-authored-by: Github Action <[email protected]>

* TUI: fix: add null check for user.time in duration calculation (sst#4679)

* ignore: update download stats 2025-11-24

* docs: add Ollama Cloud provider setup to providers.mdx (sst#4693)

* non-corpo loading spinner

* chore: format code

* release: v1.0.108

* textarea highlight cursor color

* chore: format code

* wip: zen

* ci: nix hash

* add autoupdate: notify

* zen: add opus 4.5

* wip(share): more styling

* wip(share): more styling

* wip(share): more styling

* wip(share): enterprise favicon

* fix(console): favicon issues

* chore: format code

* fix(console): remove extra favicon

* adjust bundled provider logic, fix tree shaking stuff (sst#4708)

* wip: zen

* zen: display reasoning tokens

* fix(desktop): layout

* Add --refresh flag to models command (sst#4707)

* zen: byok for gemini

* remove hardcoded openrouter provider

* release: v1.0.109

* chore: format code

* Update Nix flake.lock and hashes

---------

Co-authored-by: Aiden Cline <[email protected]>
Co-authored-by: Ariane Emory <[email protected]>
Co-authored-by: knanao <[email protected]>
Co-authored-by: knanao <[email protected]>
Co-authored-by: GitHub Action <[email protected]>
Co-authored-by: Dax Raad <[email protected]>
Co-authored-by: opencode <[email protected]>
Co-authored-by: Frank <[email protected]>
Co-authored-by: Huang Qi <[email protected]>
Co-authored-by: Albert O'Shea <[email protected]>
Co-authored-by: Aiden Cline <[email protected]>
Co-authored-by: Carli Samuele <[email protected]>
Co-authored-by: Frankie Seabrook <[email protected]>
Co-authored-by: Sebastian Herrlinger <[email protected]>
Co-authored-by: Adam <[email protected]>
Co-authored-by: Adam Hosker <[email protected]>
@ariane-emory ariane-emory deleted the feature/explicit-selected-item-colours branch November 27, 2025 04:07
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.

Unreadable text on selected list when "background": "none"

4 participants