feat(config): add theme customization (#81)
Added theme customization via config.toml #17 ``` [theme] border = "#665C54" accent = "#FABD2F" muted = "#928374" text = "#EBDBB2" text_sel = "#FBF1C7" match = "#FE8019" desc = "#A89984" desc_sel = "#EBDBB2" sel_bg = "#504945" scroll_info = "#83A598" ghost_text = "#7C6F64" hist= "#fe8019" hist_sel = "#d65d0e" sys = "#fb4934" sys_sel = "#cc241d" alias = "#b8bb26" alias_sel = "#98971a" ``` --------- Co-authored-by: verse91 <versedev.store@proton.me> Co-authored-by: VERSE <sunnyone0901@gmail.com>
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
package root
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/versenilvis/iris/internal/config"
|
||||
)
|
||||
|
||||
func TestThemeInitCommand(t *testing.T) {
|
||||
tmpDir, err := os.MkdirTemp("", "iris-theme-cmd-test")
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create temp dir: %v", err)
|
||||
}
|
||||
defer os.RemoveAll(tmpDir)
|
||||
|
||||
// UserConfigDir follows HOME on macOS and XDG_CONFIG_HOME on Unix.
|
||||
// Override both so the command cannot read or write the user's real theme.
|
||||
t.Setenv("HOME", tmpDir)
|
||||
t.Setenv("XDG_CONFIG_HOME", tmpDir)
|
||||
|
||||
ThemeInitCmd.Run(ThemeInitCmd, []string{})
|
||||
|
||||
themePath, err := config.ThemePath()
|
||||
if err != nil {
|
||||
t.Fatalf("failed to get theme path: %v", err)
|
||||
}
|
||||
if _, statErr := os.Stat(themePath); statErr != nil {
|
||||
t.Errorf("expected theme file to be created at %s, but it was not", themePath)
|
||||
}
|
||||
content, err := os.ReadFile(themePath)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to read theme file: %v", err)
|
||||
}
|
||||
if !strings.Contains(string(content), "sel_text = \"#110f18\"") {
|
||||
t.Error("expected initialized theme to include sel_text = \"#110f18\"")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user