Skip to content

Conversation

@nihil2501
Copy link

@nihil2501 nihil2501 commented Jan 18, 2026

Issues

Feature

tui-theme

Custom themes can now reference the system theme that is generated from the user's terminal color palette by using "system" as a color value:

{
  "theme": {
    "background": "system",
    "foreground": "system",
    "primary": "#ff5500"
  }
}

Performance optimization

The theme context now readies 10x faster in the by-far most common case (using one of the default themes). The speedup is due to not waiting for resources to load that are irrelevant for the requested theme.
Timed using this patch that calls console.time inside createSimpleContext.

After = 3.558ms

...
[17:05:25] [LOG] '%s: %s' 'context:Theme' '3.558ms'
...

Before = 31.264ms

...
[17:04:19] [LOG] '%s: %s' 'context:Theme' '31.264ms'
...

More details

Key behaviors

  • Custom theme loading and system palette detection each modeled w/ SolidJS's createResource
  • These in turn are accessed in SolidJS's createMemo returning (requested theme, resource loading status)
    • Considers only the relevant resource loading statuses for the given requested theme
    • Drives the reactivity into theme resolution
  • Somewhat conservative & simplistic design choices

Miscellany

  • Warning toasts on errored (this functionality could easily be removed)
  • System theme now responds to Toggle appearance
  • Theme picker list now updates on reload

Commits

Three atomic commits build up to this feature:

  1. fix(tui): system theme light & dark variants
  2. refactor(tui): theme switching & loading reactivity
  3. feat(tui): system-like custom themes

Notes

  • This can be split into 3 sequential PRs if preferred, one per atomic commit above
  • The first 2 commits might be valuable without adding this feature in the 3rd commit
  • The performance optimization is in the 2nd, refactor commit

@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found one potentially related PR:

Potentially Related:

The other results (#5020 on layout systems and #8239 on desktop appearance toggle) are related but address different aspects of the system.

Conclusion: No clear duplicate PRs found. PR #9184 appears to be implementing a novel feature for system-like custom themes in the TUI that doesn't have an existing equivalent PR.

Comment on lines +133 to +160
### Terminal defaults

The special value `"none"` can be used for any color to inherit the terminal's default color. This is particularly useful for creating themes that blend seamlessly with your terminal's color scheme:

- `"text": "none"` - Uses terminal's default foreground color
- `"background": "none"` - Uses terminal's default background color

---

### System color references

Custom themes can use `"system"` as a color value to inherit colors from your terminal's palette. This lets you create themes that blend custom branding with your terminal's native colors:

```json title="my-system-theme.json"
{
"theme": {
"background": "system",
"text": "system",
"primary": "#ff5500",
"secondary": "system",
...
}
}
```

Colors set to `"system"` will update when your terminal's palette changes (after sending SIGUSR2 to reload).

---
Copy link
Author

@nihil2501 nihil2501 Jan 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I never quite understood how none's documentation matches its implementation. none's documentation does seem to match the implementation for system though.

none's implementation returns 0s for every color key:

case "transparent":
case "none":
  return RGBA.fromInts(0, 0, 0, 0)

@nihil2501 nihil2501 force-pushed the system-theme-colors branch from c710973 to 736f101 Compare January 18, 2026 21:04
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.

[FEATURE]: Custom themes can use calculated system colors Can't use custom themes that use ANSI colors

1 participant