fix(theming): restore gruvbox as default via Default() helper

This commit is contained in:
MDietermann
2026-04-14 13:42:58 +02:00
parent 4f7411ca95
commit 698271a235
6 changed files with 28 additions and 14 deletions

View File

@@ -85,13 +85,10 @@ func nvimCfg() (string, error) {
}
func (m Module) resolvedTheme() string {
if t, ok := theming.Get(m.themeID); ok && t.NvChadTheme != "" {
if t, ok := theming.Get(m.themeID); ok {
return t.NvChadTheme
}
if list := theming.List(); len(list) > 0 && list[0].NvChadTheme != "" {
return list[0].NvChadTheme
}
return "gruvbox"
return theming.Default().NvChadTheme
}
// WriteChadrc renders chadrc.lua for the given NvChad theme name and writes

View File

@@ -160,7 +160,7 @@ func TestPlanAfterApplyIsEmpty(t *testing.T) {
}
}
func TestUnknownThemeFallsBackToFirst(t *testing.T) {
func TestUnknownThemeFallsBackToDefault(t *testing.T) {
home := t.TempDir()
t.Setenv("HOME", home)
r := &fakeRunner{installed: map[string]bool{"neovim": true}}
@@ -171,9 +171,8 @@ func TestUnknownThemeFallsBackToFirst(t *testing.T) {
t.Fatal(err)
}
chadrc, _ := os.ReadFile(filepath.Join(home, ".config", "nvim", "lua", "chadrc.lua"))
// Unknown theme IDs fall back to the first entry of theming.List(),
// which is sorted alphabetically by ID (currently "catppuccin").
if !strings.Contains(string(chadrc), `theme = "catppuccin"`) {
// Unknown theme IDs fall back to theming.Default(), which is gruvbox.
if !strings.Contains(string(chadrc), `theme = "gruvbox"`) {
t.Fatalf("fallback theme not applied: %s", chadrc)
}
}