Skip to content

refactor(tui): theme switching & loading reactivity#10472

Closed
nihil2501 wants to merge 1 commit into
anomalyco:devfrom
nihil2501:tui-theme-reactivity
Closed

refactor(tui): theme switching & loading reactivity#10472
nihil2501 wants to merge 1 commit into
anomalyco:devfrom
nihil2501:tui-theme-reactivity

Conversation

@nihil2501
Copy link
Copy Markdown

@nihil2501 nihil2501 commented Jan 25, 2026

Issues

Refactor

Remodels theme resolution reactivity with respect to this tuple:

  • The user's requested theme
  • The loading status of relevant async resources

This change also prepares for a feature, system-like custom themes, shown in this video:

tui-theme

Fixes

  • Theme picker list now updates on reload
  • Warning toasts on errored
    • These toasts could easily be removed

Performance

The theme context now readies 10x faster (30ms → 3ms) in by-far the most common case: using one of the default themes. The speedup is achieved by not waiting on resources irrelevant to the requested theme before marking it as ready.
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'
...

Implementation

  • 2x createResources
    • Custom theme loading
    • System palette detection
  • These in turn are accessed in a createMemo returning this tuple:
    • The user's requested theme
    • The loading status of relevant async resources
  • 2x createEffects
    • One to update the requested theme when the config generation increments
    • Another to promote and re-resolve the theme when our memoized tuple changes

@github-actions
Copy link
Copy Markdown
Contributor

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

No duplicate PRs found

@nihil2501
Copy link
Copy Markdown
Author

Closed #9184 in favor of this in order to incrementally introduce an atomic foundational change before considering adding a feature on top of it.

@nihil2501
Copy link
Copy Markdown
Author

nihil2501 commented Jan 29, 2026

cc @thdxr @rekram1-node this TUI theme reactivity remodel was developed while some of the Omarchy theme changes were being added, so this may be of interest / fresh in your minds.

The short Fixes and Performance sections in the PR description discuss the concrete improvements.

@thdxr thdxr force-pushed the dev branch 4 times, most recently from f1ae801 to 08fa7f7 Compare January 30, 2026 14:37
@nihil2501 nihil2501 force-pushed the tui-theme-reactivity branch 4 times, most recently from f41140c to ee5703f Compare February 11, 2026 03:24
@nihil2501 nihil2501 force-pushed the tui-theme-reactivity branch 2 times, most recently from bb86c29 to 1606248 Compare February 17, 2026 01:25
@github-actions
Copy link
Copy Markdown
Contributor

Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR.

@github-actions github-actions Bot closed this Apr 26, 2026
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.

1 participant