gemini-cli - ✅(Solved) Fix Custom theme loaded from file path is shown in /theme but cannot be selected by name [1 pull requests, 1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
google-gemini/gemini-cli#25961Fetched 2026-04-26 05:24:32
View on GitHub
Comments
1
Participants
1
Timeline
3
Reactions
0
Participants
Timeline (top)
commented ×1cross-referenced ×1labeled ×1

Root Cause

I did not include /about output because it may contain account/email information.

Fix Action

Fix / Workaround

Workaround: inline the theme under ui.customThemes and set ui.theme to the same key/name:

PR fix notes

PR #25974: fix(cli): resolve file-loaded custom theme lookup by internal name

Description (problem / solution / changelog)

Summary

Fixes a bug where file-loaded custom themes cannot be selected from the /theme menu using their internal name.

Details

The findThemeByName method was only checking this.fileThemes.has(themeName), which uses the canonical file path as the key. This update iterates over the values of this.fileThemes to also match against the name property.

Related Issues

Fixes #25961

How to Validate

  1. Configure a custom theme in ~/.gemini/config.json via file path (e.g. "theme": "/path/to/theme.json").
  2. Start the CLI and run /theme.
  3. Select the custom theme from the list (which displays its internal name).
  4. Verify the theme is successfully applied instead of throwing "Theme not found". Alternatively, run npm test -w @google/gemini-cli -- src/ui/themes/theme-manager.test.ts.

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

Changed files

  • packages/cli/src/ui/themes/theme-manager.test.ts (modified, +14/-0)
  • packages/cli/src/ui/themes/theme-manager.ts (modified, +7/-0)

Code Example

{
  "ui": {
    "theme": "C:\\Users\\Admin\\.gemini\\themes\\catppuccin-mocha.json"
  }
}

---

{
  "name": "Catppuccin Mocha",
  "type": "custom",
  "Background": "#1e1e2e",
  "Foreground": "#cdd6f4",
  "LightBlue": "#89dceb",
  "AccentBlue": "#89b4fa",
  "AccentPurple": "#cba6f7",
  "AccentCyan": "#94e2d5",
  "AccentGreen": "#a6e3a1",
  "AccentYellow": "#f9e2af",
  "AccentRed": "#f38ba8",
  "Comment": "#9399b2",
  "Gray": "#7f849c",
  "DiffAdded": "#546d5c",
  "DiffRemoved": "#734a5f",
  "GradientColors": ["#89b4fa", "#cba6f7", "#f38ba8"]
}

---

{
  "ui": {
    "theme": "Catppuccin Mocha",
    "customThemes": {
      "Catppuccin Mocha": {
        "name": "Catppuccin Mocha",
        "type": "custom"
      }
    }
  }
}
RAW_BUFFERClick to expand / collapse

What happened?

A custom theme loaded from a JSON file path can appear in the /theme picker, but selecting/highlighting it by its display name fails with Theme "<name>" not found.

Observed with Catppuccin Mocha on Windows using Gemini CLI 0.39.1.

Initial settings:

{
  "ui": {
    "theme": "C:\\Users\\Admin\\.gemini\\themes\\catppuccin-mocha.json"
  }
}

Theme file contains:

{
  "name": "Catppuccin Mocha",
  "type": "custom",
  "Background": "#1e1e2e",
  "Foreground": "#cdd6f4",
  "LightBlue": "#89dceb",
  "AccentBlue": "#89b4fa",
  "AccentPurple": "#cba6f7",
  "AccentCyan": "#94e2d5",
  "AccentGreen": "#a6e3a1",
  "AccentYellow": "#f9e2af",
  "AccentRed": "#f38ba8",
  "Comment": "#9399b2",
  "Gray": "#7f849c",
  "DiffAdded": "#546d5c",
  "DiffRemoved": "#734a5f",
  "GradientColors": ["#89b4fa", "#cba6f7", "#f38ba8"]
}

Steps to reproduce:

  1. Put the theme JSON above at C:\Users\Admin\.gemini\themes\catppuccin-mocha.json.
  2. Set ui.theme to the JSON file path.
  3. Start Gemini CLI.
  4. Open /theme.
  5. Highlight/select Catppuccin Mocha.

Result: the picker lists Catppuccin Mocha as a custom theme, but Gemini shows Theme "Catppuccin Mocha" not found.

From inspecting the bundled JS, startup calls themeManager.setActiveTheme(settings.merged.ui.theme), and findThemeByName() loads file themes when the configured value is a path. However, the /theme dialog later calls applyTheme(themeName) with the display/internal name (Catppuccin Mocha). findThemeByName() does not appear to resolve file-loaded themes by their internal name, only by path/canonical path or settings/extension theme keys.

What did you expect to happen?

If a custom theme loaded from a JSON file path is shown in /theme using its internal name, selecting/highlighting that item should activate the theme successfully.

Alternatively, /theme should use the original file path as the value passed to setActiveTheme() for file-loaded themes.

Client information

<details> <summary>Client Information</summary>

Platform: Windows, PowerShell Gemini CLI version: 0.39.1 Install path: C:\Users\Admin\.bun\bin\gemini.exe

I did not include /about output because it may contain account/email information.

</details>

Login information

Google account OAuth (oauth-personal).

Anything else we need to know?

Workaround: inline the theme under ui.customThemes and set ui.theme to the same key/name:

{
  "ui": {
    "theme": "Catppuccin Mocha",
    "customThemes": {
      "Catppuccin Mocha": {
        "name": "Catppuccin Mocha",
        "type": "custom"
      }
    }
  }
}

With the full color object in ui.customThemes, startup no longer warns and the theme name lookup works.

extent analysis

TL;DR

To fix the issue, inline the custom theme under ui.customThemes and set ui.theme to the same key/name.

Guidance

  • The issue arises from the discrepancy between how themes are loaded from files and how they are referenced by name in the /theme dialog.
  • The current implementation of findThemeByName() does not resolve file-loaded themes by their internal name, only by path or settings/extension theme keys.
  • To mitigate this, use the provided workaround of inlining the theme under ui.customThemes.
  • Ensure that the ui.theme setting matches the key used in ui.customThemes for the custom theme.

Example

{
  "ui": {
    "theme": "Catppuccin Mocha",
    "customThemes": {
      "Catppuccin Mocha": {
        "name": "Catppuccin Mocha",
        "type": "custom",
        "Background": "#1e1e2e",
        "Foreground": "#cdd6f4",
        "LightBlue": "#89dceb",
        "AccentBlue": "#89b4fa",
        "AccentPurple": "#cba6f7",
        "AccentCyan": "#94e2d5",
        "AccentGreen": "#a6e3a1",
        "AccentYellow": "#f9e2af",
        "AccentRed": "#f38ba8",
        "Comment": "#9399b2",
        "Gray": "#7f849c",
        "DiffAdded": "#546d5c",
        "DiffRemoved": "#734a5f",
        "GradientColors": ["#89b4fa", "#cba6f7", "#f38ba8"]
      }
    }
  }
}

Notes

This workaround requires including the full theme object in the settings, which may not be ideal for large themes

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING