mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-10-09 15:58:34 +00:00
eee7a8846c
Replace parallel preview/pending follow-app pipelines with a single runtime that drives xterm, side panel, host tree, and top tabs together in both follow-app and manual modes. Co-authored-by: Cursor <cursoragent@cursor.com>
64 lines
2.0 KiB
TypeScript
64 lines
2.0 KiB
TypeScript
import type { TerminalTheme } from '../../domain/models';
|
|
import { TERMINAL_THEMES, getBuiltinTerminalThemeById } from '../../infrastructure/config/terminalThemes';
|
|
import {
|
|
applyCustomAccentToTerminalTheme,
|
|
resolveFollowAppTerminalThemeId,
|
|
resolveManualTerminalThemeId,
|
|
} from '../../domain/terminalAppearance';
|
|
|
|
interface ResolveCurrentTerminalThemeParams {
|
|
terminalThemeId: string;
|
|
terminalThemeDarkId: string;
|
|
terminalThemeLightId: string;
|
|
customThemes: TerminalTheme[];
|
|
followAppTerminalTheme: boolean;
|
|
pendingFollowAppTerminalThemeId?: string | null;
|
|
resolvedTheme: 'light' | 'dark';
|
|
lightUiThemeId: string;
|
|
darkUiThemeId: string;
|
|
accentMode: 'theme' | 'custom';
|
|
customAccent: string;
|
|
}
|
|
|
|
export function resolveCurrentTerminalTheme({
|
|
terminalThemeId,
|
|
terminalThemeDarkId,
|
|
terminalThemeLightId,
|
|
customThemes,
|
|
followAppTerminalTheme,
|
|
pendingFollowAppTerminalThemeId = null,
|
|
resolvedTheme,
|
|
lightUiThemeId,
|
|
darkUiThemeId,
|
|
accentMode,
|
|
customAccent,
|
|
}: ResolveCurrentTerminalThemeParams): TerminalTheme {
|
|
if (followAppTerminalTheme) {
|
|
const followedId = resolveFollowAppTerminalThemeId(pendingFollowAppTerminalThemeId, {
|
|
resolvedTheme,
|
|
lightUiThemeId,
|
|
darkUiThemeId,
|
|
fallbackThemeId: terminalThemeId,
|
|
});
|
|
const followed = getBuiltinTerminalThemeById(followedId)
|
|
|| customThemes.find(t => t.id === followedId);
|
|
if (followed) {
|
|
return applyCustomAccentToTerminalTheme(followed, accentMode, customAccent);
|
|
}
|
|
}
|
|
const manualThemeId = resolveManualTerminalThemeId({
|
|
resolvedTheme,
|
|
terminalThemeDarkId,
|
|
terminalThemeLightId,
|
|
lightUiThemeId,
|
|
darkUiThemeId,
|
|
fallbackThemeId: terminalThemeId,
|
|
});
|
|
const baseTheme = getBuiltinTerminalThemeById(manualThemeId)
|
|
|| customThemes.find(t => t.id === manualThemeId)
|
|
|| getBuiltinTerminalThemeById(terminalThemeId)
|
|
|| customThemes.find(t => t.id === terminalThemeId)
|
|
|| TERMINAL_THEMES[0];
|
|
return applyCustomAccentToTerminalTheme(baseTheme, accentMode, customAccent);
|
|
}
|