()
| 1125 | * Recompute system theme and update store if it changed |
| 1126 | */ |
| 1127 | const recomputeSystemTheme = () => { |
| 1128 | const env = getCliEnv() |
| 1129 | // Only recompute if theme is auto-detected (not explicitly set) |
| 1130 | const envPreference = env.OPEN_TUI_THEME ?? env.OPENTUI_THEME |
| 1131 | if (envPreference && envPreference.toLowerCase() !== 'opposite') { |
| 1132 | // User explicitly set theme, don't react to system changes |
| 1133 | return |
| 1134 | } |
| 1135 | |
| 1136 | if (!themeResolver) { |
| 1137 | return |
| 1138 | } |
| 1139 | |
| 1140 | const newTheme = themeResolver() |
| 1141 | |
| 1142 | // Always call the updater and let it decide if an update is needed |
| 1143 | if (themeStoreUpdater) { |
| 1144 | themeStoreUpdater(newTheme) |
| 1145 | } |
| 1146 | } |
| 1147 | |
| 1148 | /** |
| 1149 | * Debounced version of recomputeSystemTheme for file watcher events |
no test coverage detected