diff --git a/.workflow/info.plist b/.workflow/info.plist index 21ecff2..d52e2e7 100755 --- a/.workflow/info.plist +++ b/.workflow/info.plist @@ -1685,11 +1685,32 @@ https://github.com/cage1016/alfred-paletter description recommend 1 ~ 10 label - Number of Color + Number of Colors type textfield variable - number_of_color + number_of_colors + + + config + + default + 10 + placeholder + digital + required + + trim + + + description + + label + Number of Clipboard Images + type + textfield + variable + number_of_clipboard_images version diff --git a/alfred/config.go b/alfred/config.go index 402ca10..5b73099 100644 --- a/alfred/config.go +++ b/alfred/config.go @@ -5,19 +5,14 @@ import ( ) const ( - NumberOfColor = "number_of_color" - ColorsHexWithHash = "colors_hex_with_hash" - CopyAllSeparate = "copy_all_separate" + NumberOfColors = "number_of_colors" + NumberOfClipboardImages = "number_of_clipboard_images" ) -func GetNumberOfColor(wf *aw.Workflow) int { - return wf.Config.GetInt(NumberOfColor, 3) +func GetNumberOfColors(wf *aw.Workflow) int { + return wf.Config.GetInt(NumberOfColors, 7) } -func GetColorsHexWithHash(wf *aw.Workflow) bool { - return wf.Config.GetBool(ColorsHexWithHash) -} - -func GetCopyAllSeparate(wf *aw.Workflow) bool { - return wf.Config.GetBool(CopyAllSeparate) +func GetNumberOfClipboard(wf *aw.Workflow) int { + return wf.Config.GetInt(NumberOfClipboardImages, 10) } diff --git a/cmd/paletter.go b/cmd/paletter.go index 30232ac..e20951c 100644 --- a/cmd/paletter.go +++ b/cmd/paletter.go @@ -77,11 +77,11 @@ var paletterCmd = &cobra.Command{ if r != "" { nc, _ := strconv.Atoi(strings.TrimSpace(r)) if nc == 0 { - nc = alfred.GetNumberOfColor(wf) + nc = alfred.GetNumberOfColors(wf) } cs, _ = paletter.CalculatePalette(obs, nc) } else { - cs, _ = paletter.CalculatePalette(obs, alfred.GetNumberOfColor(wf)) + cs, _ = paletter.CalculatePalette(obs, alfred.GetNumberOfColors(wf)) } colors := paletter.ColorsFromClusters(cs) diff --git a/cmd/paletterfi.go b/cmd/paletterfi.go index 01dada6..448da97 100644 --- a/cmd/paletterfi.go +++ b/cmd/paletterfi.go @@ -13,6 +13,7 @@ import ( aw "github.com/deanishe/awgo" "github.com/spf13/cobra" + "github.com/cage1016/alfred-paletter/alfred" "github.com/cage1016/alfred-paletter/lib" "github.com/cage1016/alfred-paletter/sqlite" ) @@ -44,7 +45,7 @@ var aCmd = &cobra.Command{ } items, err = repo.List(context.Background(), nc) } else { - items, err = repo.List(context.Background(), 10) + items, err = repo.List(context.Background(), alfred.GetNumberOfClipboard(wf)) } if err != nil { diff --git a/lib/paletter.go b/lib/paletter.go index 9c982c2..4839522 100644 --- a/lib/paletter.go +++ b/lib/paletter.go @@ -7,8 +7,6 @@ import ( aw "github.com/deanishe/awgo" color "github.com/lucasb-eyer/go-colorful" - - "github.com/cage1016/alfred-paletter/alfred" ) const ( @@ -47,9 +45,6 @@ func (hs HexColors) Hexs() []string { } func Hex(wf *aw.Workflow, col color.Color) string { - if alfred.GetColorsHexWithHash(wf) { - return fmt.Sprintf(hexPatternHash, uint8(col.R*255.0+0.5), uint8(col.G*255.0+0.5), uint8(col.B*255.0+0.5)) - } return fmt.Sprintf(hexPattern, uint8(col.R*255.0+0.5), uint8(col.G*255.0+0.5), uint8(col.B*255.0+0.5)) }