diff --git a/color_darwin.go b/color_darwin.go index 7fcd6cd..b32a5c8 100644 --- a/color_darwin.go +++ b/color_darwin.go @@ -10,13 +10,15 @@ import ( func selectColor(options []Option) (color.Color, error) { opts := applyOptions(options) - var data zenutil.Color + var col color.Color if opts.color != nil { - n := color.NRGBA64Model.Convert(opts.color).(color.NRGBA64) - data.Color = []uint16{n.R, n.G, n.B} + col = opts.color + } else { + col = color.White } + r, g, b, _ := col.RGBA() - out, err := zenutil.Run(opts.ctx, "color", data) + out, err := zenutil.Run(opts.ctx, "color", []uint32{r, g, b}) if err, ok := err.(*exec.ExitError); ok && err.ExitCode() == 1 { return nil, nil } diff --git a/go.sum b/go.sum index c04ce53..5675ec1 100644 --- a/go.sum +++ b/go.sum @@ -1,9 +1,5 @@ -github.com/akavel/rsrc v0.8.0 h1:zjWn7ukO9Kc5Q62DOJCcxGpXC18RawVtYAGdz2aLlfw= -github.com/akavel/rsrc v0.8.0/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/josephspurrier/goversioninfo v1.2.0 h1:tpLHXAxLHKHg/dCU2AAYx08A4m+v9/CWg6+WUvTF4uQ= -github.com/josephspurrier/goversioninfo v1.2.0/go.mod h1:AGP2a+Y/OVJZ+s6XM4IwFUpkETwvn0orYurY8qpw1+0= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= diff --git a/internal/zenutil/osa_generated.go b/internal/zenutil/osa_generated.go index 24d2a19..1ca7ac7 100644 --- a/internal/zenutil/osa_generated.go +++ b/internal/zenutil/osa_generated.go @@ -13,11 +13,7 @@ var scripts = template.Must(template.New("").Funcs(template.FuncMap{"json": func {{define "color" -}} tell application (path to frontmost application as text) activate -{{if .Color -}} -set c to choose color default color { {{index .Color 0}},{{index .Color 1}},{{index .Color 2}} } -{{else -}} -set c to choose color -{{end}} +set c to choose color default color { {{index . 0}},{{index . 1}},{{index . 2}} } "rgb(" & (item 1 of c) div 256 & "," & (item 2 of c) div 256 & "," & (item 3 of c) div 256 & ")" end tell {{- end}} diff --git a/internal/zenutil/osascripts/color.applescript b/internal/zenutil/osascripts/color.applescript index 127055c..b1197f8 100644 --- a/internal/zenutil/osascripts/color.applescript +++ b/internal/zenutil/osascripts/color.applescript @@ -1,9 +1,5 @@ tell application (path to frontmost application as text) activate - {{if .Color -}} - set c to choose color default color { {{index .Color 0}},{{index .Color 1}},{{index .Color 2}} } - {{else -}} - set c to choose color - {{end}} + set c to choose color default color { {{index . 0}},{{index . 1}},{{index . 2}} } "rgb(" & (item 1 of c) div 256 & "," & (item 2 of c) div 256 & "," & (item 3 of c) div 256 & ")" end tell \ No newline at end of file diff --git a/internal/zenutil/run_darwin.go b/internal/zenutil/run_darwin.go index 0c24522..b612697 100644 --- a/internal/zenutil/run_darwin.go +++ b/internal/zenutil/run_darwin.go @@ -56,10 +56,6 @@ type File struct { Multiple bool } -type Color struct { - Color []uint16 -} - type Msg struct { Operation string Text string