-func LoadColorscheme(colorschemeName, dir string) {
- files, _ := ioutil.ReadDir(dir)
- found := false
- for _, f := range files {
- if f.Name() == colorschemeName+".micro" {
- text, err := ioutil.ReadFile(dir + "/" + f.Name())
- if err != nil {
- fmt.Println("Error loading colorscheme:", err)
- continue
- }
- colorscheme = ParseColorscheme(string(text))
- found = true
- }
- }
+func LoadColorscheme(colorschemeName string) {
+ file := FindRuntimeFile(RTColorscheme, colorschemeName)
+ if file == nil {
+ TermMessage(colorschemeName, "is not a valid colorscheme")
+ } else {
+ if data, err := file.Data(); err != nil {
+ TermMessage("Error loading colorscheme:", err)
+ } else {
+ colorscheme = ParseColorscheme(string(data))