-
Notifications
You must be signed in to change notification settings - Fork 3.4k
feature: optional selectedListItemText element in themes and luminance-based fallback to solve 4369 #4572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: optional selectedListItemText element in themes and luminance-based fallback to solve 4369 #4572
Conversation
…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.
…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.
48144e6 to
23f082e
Compare
|
If selectedListItemTextcolour is present in the theme, it is used. Otherwise, knanao's luminance-based colour selection is used. |
cc5d9a7 to
48949a6
Compare
|
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. |
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 |
917250b to
f4593c6
Compare
@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?
|
|
@jensenojs c107e3c is an example implementation of this approach. {
...
"theme": {
"backgroundMenu": "#1c1c1c",
...
}
|
f1dc981 to
3e15a39
Compare
df8bdf9 to
0dd5039
Compare
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
|
Merged in knanao's latest changes. |
…ected-item-colours
|
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"
}
} |
|
FYI |
…e-based fallback to solve 4369 (sst#4572) Co-authored-by: knanao <[email protected]> Co-authored-by: knanao <[email protected]>
* 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]>








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 aprimarybackground (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:
it defaults to the background colour, preserving current behaviour
use theme.selectedListItemText instead of theme.background
Backward compatibility:
Components updated:
Example of usage in a custom theme:
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.