Add custom theming

This commit is contained in:
2026-07-28 20:09:40 +02:00
parent a0098a3946
commit ef32aa473e
14 changed files with 687 additions and 147 deletions

View File

@@ -87,6 +87,39 @@ up = ["ctrl+k"]
}
}
func TestLoadConfigParsesCustomTheme(t *testing.T) {
path := filepath.Join(t.TempDir(), "config.toml")
content := `
theme = "custom"
[custom_theme]
base = "catppuccin-mocha"
mode = "dark"
title = "#112233"
selection_background = "#223344"
author_palette = ["#334455", "#445566"]
syntax_theme = "gruvbox"
`
if err := os.WriteFile(path, []byte(content), 0o600); err != nil {
t.Fatal(err)
}
got, err := loadConfig(path, true)
if err != nil {
t.Fatal(err)
}
if err := validateConfig(got); err != nil {
t.Fatal(err)
}
if got.Theme != "custom" ||
got.CustomTheme.Base != "catppuccin-mocha" ||
got.CustomTheme.Title != "#112233" ||
got.CustomTheme.SelectionBackground != "#223344" ||
len(got.CustomTheme.AuthorPalette) != 2 ||
got.CustomTheme.SyntaxTheme != "gruvbox" {
t.Fatalf("custom theme config = %#v", got.CustomTheme)
}
}
func TestValidateConfigRejectsEmptyKeyBinding(t *testing.T) {
config := defaultConfig()
config.KeyBindings.Navigation.Down = nil