summaryrefslogtreecommitdiff
path: root/internal/switcher/switcher.go
diff options
context:
space:
mode:
authorBenjamin Chausse <benjamin@chausse.xyz>2024-11-24 04:01:37 -0500
committerBenjamin Chausse <benjamin@chausse.xyz>2024-11-24 04:01:37 -0500
commit8b4d17786425b63ec45f6df189eab1ea7dcbf6a7 (patch)
tree9a3142e0047dd283f4ba739ef473a0346c7599ad /internal/switcher/switcher.go
parent84221bddb581ecdb78ba36e2cf5e61665f2be5f9 (diff)
Freaking hsl doesn't reset to cyan everytime
Diffstat (limited to 'internal/switcher/switcher.go')
-rw-r--r--internal/switcher/switcher.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/internal/switcher/switcher.go b/internal/switcher/switcher.go
index b534e54..c470557 100644
--- a/internal/switcher/switcher.go
+++ b/internal/switcher/switcher.go
@@ -73,26 +73,33 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
cs := m.pickers[m.active].GetColor()
m.Next()
m.pickers[m.active].SetColor(cs)
+
case key.Matches(msg, keys.prev):
cs := m.pickers[m.active].GetColor()
m.Prev()
m.pickers[m.active].SetColor(cs)
+
case key.Matches(msg, keys.cpHex):
util.Copy(colors.Hex(m.pickers[m.active].GetColor()))
+
case key.Matches(msg, keys.cpRgb):
pc := m.pickers[m.active].GetColor().ToPrecise()
rgb := colors.RGB{}.FromPrecise(pc).(colors.RGB)
util.Copy(rgb.String())
+
case key.Matches(msg, keys.cpHsl):
pc := m.pickers[m.active].GetColor().ToPrecise()
hsl := colors.HSL{}.FromPrecise(pc).(colors.HSL)
util.Copy(hsl.String())
+
case key.Matches(msg, keys.cpCmyk):
pc := m.pickers[m.active].GetColor().ToPrecise()
cmyk := colors.CMYK{}.FromPrecise(pc).(colors.CMYK)
util.Copy(cmyk.String())
+
case key.Matches(msg, keys.quit):
return quit.Model{}, tea.Quit
+
default:
// Update the picker
newActive, cmd := m.pickers[m.active].Update(msg)