From 53d7cbf983420753e83a22e24aa8d19f413f3ff3 Mon Sep 17 00:00:00 2001 From: Benjamin Chaussé Date: Mon, 16 Dec 2024 13:34:44 -0500 Subject: Copy hex escape sequences directly --- internal/switcher/keys.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'internal/switcher/keys.go') 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", ), ), -- cgit v1.2.3