summaryrefslogtreecommitdiff
path: root/packages/cli/src/config/settings.ts
diff options
context:
space:
mode:
authorAli Al Jufairi <[email protected]>2025-07-20 16:51:18 +0900
committerGitHub <[email protected]>2025-07-20 07:51:18 +0000
commit76b935d598b895240b9bc2b182eb9f1e1b24be0d (patch)
treecc76fb76a8655f7ab9a064b6c2af750726dd2478 /packages/cli/src/config/settings.ts
parentc0bfa388c571342265915f8de888a43190c82759 (diff)
Feature custom themes logic (#2639)
Co-authored-by: Jacob Richman <[email protected]>
Diffstat (limited to 'packages/cli/src/config/settings.ts')
-rw-r--r--packages/cli/src/config/settings.ts30
1 files changed, 23 insertions, 7 deletions
diff --git a/packages/cli/src/config/settings.ts b/packages/cli/src/config/settings.ts
index 604e89dc..24b9e9e6 100644
--- a/packages/cli/src/config/settings.ts
+++ b/packages/cli/src/config/settings.ts
@@ -19,6 +19,7 @@ import {
import stripJsonComments from 'strip-json-comments';
import { DefaultLight } from '../ui/themes/default-light.js';
import { DefaultDark } from '../ui/themes/default.js';
+import { CustomTheme } from '../ui/themes/theme.js';
export const SETTINGS_DIRECTORY_NAME = '.gemini';
export const USER_SETTINGS_DIR = path.join(homedir(), SETTINGS_DIRECTORY_NAME);
@@ -56,6 +57,7 @@ export interface AccessibilitySettings {
export interface Settings {
theme?: string;
+ customThemes?: Record<string, CustomTheme>;
selectedAuthType?: AuthType;
sandbox?: boolean | string;
coreTools?: string[];
@@ -84,6 +86,7 @@ export interface Settings {
// UI setting. Does not display the ANSI-controlled terminal title.
hideWindowTitle?: boolean;
+
hideTips?: boolean;
hideBanner?: boolean;
@@ -132,10 +135,24 @@ export class LoadedSettings {
}
private computeMergedSettings(): Settings {
+ const system = this.system.settings;
+ const user = this.user.settings;
+ const workspace = this.workspace.settings;
+
return {
- ...this.user.settings,
- ...this.workspace.settings,
- ...this.system.settings,
+ ...user,
+ ...workspace,
+ ...system,
+ customThemes: {
+ ...(user.customThemes || {}),
+ ...(workspace.customThemes || {}),
+ ...(system.customThemes || {}),
+ },
+ mcpServers: {
+ ...(user.mcpServers || {}),
+ ...(workspace.mcpServers || {}),
+ ...(system.mcpServers || {}),
+ },
};
}
@@ -152,13 +169,12 @@ export class LoadedSettings {
}
}
- setValue(
+ setValue<K extends keyof Settings>(
scope: SettingScope,
- key: keyof Settings,
- value: string | Record<string, MCPServerConfig> | undefined,
+ key: K,
+ value: Settings[K],
): void {
const settingsFile = this.forScope(scope);
- // @ts-expect-error - value can be string | Record<string, MCPServerConfig>
settingsFile.settings[key] = value;
this._merged = this.computeMergedSettings();
saveSettings(settingsFile);