summaryrefslogtreecommitdiff
path: root/internal/switcher/keys.go
diff options
context:
space:
mode:
authorBenjamin Chausse <benjamin@chausse.xyz>2024-12-17 13:57:44 -0500
committerGitHub <noreply@github.com>2024-12-17 13:57:44 -0500
commitaddb4ad9f27c74693638cf4d169be9e83ac4a752 (patch)
tree7db38fe9d4ea4fc92237cfcc8c7a4d59749ac9e5 /internal/switcher/keys.go
parent7938c2926338526390624a1f9004f6ad2699cd2b (diff)
Copy hex escape sequences directly (#24)
Co-authored-by: Benjamin Chaussé <Benjamin.Chausse@goto.com>
Diffstat (limited to 'internal/switcher/keys.go')
-rw-r--r--internal/switcher/keys.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/internal/switcher/keys.go b/internal/switcher/keys.go
index 73ba710..0bf7111 100644
--- a/internal/switcher/keys.go
+++ b/internal/switcher/keys.go
@@ -7,10 +7,12 @@ import (
)
const (
- cpHex = "x"
- cpRGB = "r"
- cpHSL = "s"
- cpCMYK = "c"
+ cpHex = "x"
+ cpRGB = "r"
+ cpHSL = "s"
+ cpCMYK = "c"
+ cpEscFG = "f"
+ cpEscBG = "b"
)
type keybinds struct {
@@ -18,6 +20,7 @@ type keybinds struct {
}
func newKeybinds() keybinds {
+ cpKeys := []string{cpHex, cpRGB, cpHSL, cpCMYK, cpEscBG, cpEscFG}
return keybinds{
next: key.NewBinding(
key.WithKeys("tab"),
@@ -28,9 +31,9 @@ func newKeybinds() keybinds {
key.WithHelp("shift+tab", "prev picker"),
),
copy: key.NewBinding(
- key.WithKeys(cpHex, cpRGB, cpHSL, cpCMYK),
+ key.WithKeys(cpKeys...),
key.WithHelp(
- strings.Join([]string{cpHex, cpRGB, cpHSL, cpCMYK}, "/"),
+ strings.Join(cpKeys, "/"),
"copy color",
),
),