summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go39
1 files changed, 3 insertions, 36 deletions
diff --git a/main.go b/main.go
index 8de90a9..78834c8 100644
--- a/main.go
+++ b/main.go
@@ -14,40 +14,6 @@ import (
plist "github.com/DHowett/go-plist"
)
-const t = `! Color scheme: {{.Name}}
-*foreground: {{.Foreground}}
-*background: {{.Background}}
-*cursorColor: {{.Cursor}}
-! Black
-*color0: {{.Ansi0}}
-*color8: {{.Ansi8}}
-! Red
-*color1: {{.Ansi1}}
-*color9: {{.Ansi9}}
-! Green
-*color2: {{.Ansi2}}
-*color10: {{.Ansi10}}
-! Yellow
-*color3: {{.Ansi3}}
-*color11: {{.Ansi11}}
-! Blue
-*color4: {{.Ansi4}}
-*color12: {{.Ansi12}}
-! Magenta
-*color5: {{.Ansi5}}
-*color13: {{.Ansi13}}
-! Cyan
-*color6: {{.Ansi6}}
-*color14: {{.Ansi14}}
-! White
-*color7: {{.Ansi7}}
-*color15: {{.Ansi15}}
-! Bold
-*colorBD: {{.Bold}}
-!*colorIT:
-!*colorUL:
-`
-
type Scheme struct {
Name string
Ansi0 Color `plist:"Ansi 0 Color"`
@@ -99,6 +65,7 @@ func name(s string) string {
func main() {
file := flag.String("file", "", "Color scheme .itemcolors")
+ tmpl := flag.String("tmpl", "scheme.tmpl", "Xresources template")
flag.Parse()
body, err := ioutil.ReadFile(*file)
if err != nil {
@@ -108,10 +75,10 @@ func main() {
if _, err := plist.Unmarshal(body, &s); err != nil {
log.Fatal(err)
}
- tmpl, err := template.New("xrdb").Parse(t)
+ t, err := template.ParseFiles(*tmpl)
if err != nil {
log.Fatal(err)
}
s.Name = name(*file)
- tmpl.Execute(os.Stdout, s)
+ t.Execute(os.Stdout, s)
}