diff options
| author | Jacob Richman <[email protected]> | 2025-05-01 10:34:07 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-05-01 10:34:07 -0700 |
| commit | 7e8f379dfbd4d70050ce301a42a38ba9c1f052f4 (patch) | |
| tree | 7d712dd0b3b6b246bc7dd92048cc91c5317a3a47 /packages/cli/src/ui/themes/theme-manager.ts | |
| parent | a18eea8c23dfb6759472d6b0bb80e13c2d6ef736 (diff) | |
Save settings to ~/.gemini/settings.json and optionally /your/workspace/.gemini/settings.json (#237)
Diffstat (limited to 'packages/cli/src/ui/themes/theme-manager.ts')
| -rw-r--r-- | packages/cli/src/ui/themes/theme-manager.ts | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/packages/cli/src/ui/themes/theme-manager.ts b/packages/cli/src/ui/themes/theme-manager.ts index 5a880705..4a8cc32c 100644 --- a/packages/cli/src/ui/themes/theme-manager.ts +++ b/packages/cli/src/ui/themes/theme-manager.ts @@ -19,8 +19,9 @@ export interface ThemeDisplay { active: boolean; } +export const DEFAULT_THEME: Theme = VS2015; + class ThemeManager { - private static readonly DEFAULT_THEME: Theme = VS2015; private readonly availableThemes: Theme[]; private activeTheme: Theme; @@ -35,7 +36,7 @@ class ThemeManager { XCode, ANSI, ]; - this.activeTheme = ThemeManager.DEFAULT_THEME; + this.activeTheme = DEFAULT_THEME; } /** @@ -52,10 +53,8 @@ class ThemeManager { * Sets the active theme. * @param themeName The name of the theme to activate. */ - setActiveTheme(themeName: string): void { - const foundTheme = this.availableThemes.find( - (theme) => theme.name === themeName, - ); + setActiveTheme(themeName: string | undefined): void { + const foundTheme = this.findThemeByName(themeName); if (foundTheme) { this.activeTheme = foundTheme; @@ -64,6 +63,13 @@ class ThemeManager { } } + findThemeByName(themeName: string | undefined): Theme | undefined { + if (!themeName) { + return DEFAULT_THEME; + } + return this.availableThemes.find((theme) => theme.name === themeName); + } + /** * Returns the currently active theme object. */ |
