From addb4ad9f27c74693638cf4d169be9e83ac4a752 Mon Sep 17 00:00:00 2001 From: Benjamin Chausse Date: Tue, 17 Dec 2024 13:57:44 -0500 Subject: Copy hex escape sequences directly (#24) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Benjamin Chaussé --- internal/switcher/misc.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'internal/switcher/misc.go') diff --git a/internal/switcher/misc.go b/internal/switcher/misc.go index e87f219..d34a3bc 100644 --- a/internal/switcher/misc.go +++ b/internal/switcher/misc.go @@ -8,10 +8,6 @@ import ( "github.com/ChausseBenjamin/termpicker/internal/util" ) -const ( - okCpMsg = "Copied %s to clipboard as %s" -) - func (m Model) copyColor(format string) string { pc := m.pickers[m.active].GetColor().ToPrecise() switch format { @@ -26,6 +22,10 @@ func (m Model) copyColor(format string) string { case cpCMYK: cmyk := colors.CMYK{}.FromPrecise(pc).(colors.CMYK) return util.Copy(cmyk.String()) + case cpEscFG: + return util.Copy(colors.EscapedSeq(m.pickers[m.active].GetColor(), true)) + case cpEscBG: + return util.Copy(colors.EscapedSeq(m.pickers[m.active].GetColor(), false)) default: return "Copy format not supported" } -- cgit v1.2.3