Add custom theming
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user