Save settings to ~/.gemini/settings.json and optionally /your/workspace/.gemini/settings.json (#237)

This commit is contained in:
Jacob Richman 2025-05-01 10:34:07 -07:00 committed by GitHub
parent a18eea8c23
commit 7e8f379dfb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 284 additions and 36 deletions

View file

@ -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.
*/