summaryrefslogtreecommitdiff
path: root/internal/picker
diff options
context:
space:
mode:
Diffstat (limited to 'internal/picker')
-rw-r--r--internal/picker/defaults.go37
-rw-r--r--internal/picker/picker.go17
2 files changed, 29 insertions, 25 deletions
diff --git a/internal/picker/defaults.go b/internal/picker/defaults.go
index a7a0d89..5500465 100644
--- a/internal/picker/defaults.go
+++ b/internal/picker/defaults.go
@@ -1,31 +1,34 @@
package picker
import (
- "github.com/ChausseBenjamin/termpicker/internal/progress"
"github.com/ChausseBenjamin/termpicker/internal/slider"
+ "github.com/ChausseBenjamin/termpicker/internal/ui"
)
func RGB() *Model {
- r := slider.New('R', 255, progress.WithGradient("#660000", "#ff0000"))
- g := slider.New('G', 255, progress.WithGradient("#006600", "#00ff00"))
- b := slider.New('B', 255, progress.WithGradient("#000066", "#0000ff"))
- rgb := New([]slider.Model{r, g, b}, "RGB")
- return rgb
+ return New(
+ []slider.Model{
+ slider.New('R', 255, ui.Style().Sliders.R...),
+ slider.New('G', 255, ui.Style().Sliders.G...),
+ slider.New('B', 255, ui.Style().Sliders.B...),
+ }, "RGB")
}
func CMYK() *Model {
- c := slider.New('C', 100, progress.WithGradient("#006666", "#00ffff"))
- m := slider.New('M', 100, progress.WithGradient("#660066", "#ff00ff"))
- y := slider.New('Y', 100, progress.WithGradient("#666600", "#ffff00"))
- k := slider.New('K', 100, progress.WithSolidFill("#000000"))
- cmyk := New([]slider.Model{c, m, y, k}, "CMYK")
- return cmyk
+ return New(
+ []slider.Model{
+ slider.New('C', 100, ui.Style().Sliders.C...),
+ slider.New('M', 100, ui.Style().Sliders.M...),
+ slider.New('Y', 100, ui.Style().Sliders.Y...),
+ slider.New('K', 100, ui.Style().Sliders.K...),
+ }, "CMYK")
}
func HSL() *Model {
- h := slider.New('H', 360, progress.WithDefaultGradient())
- s := slider.New('S', 100, progress.WithGradient("#a68e59", "#ffae00"))
- l := slider.New('L', 100, progress.WithGradient("#222222", "#ffffff"))
- hsl := New([]slider.Model{h, s, l}, "HSL")
- return hsl
+ return New(
+ []slider.Model{
+ slider.New('H', 360, ui.Style().Sliders.H...),
+ slider.New('S', 100, ui.Style().Sliders.S...),
+ slider.New('L', 100, ui.Style().Sliders.L...),
+ }, "HSL")
}
diff --git a/internal/picker/picker.go b/internal/picker/picker.go
index 5a7493d..3094396 100644
--- a/internal/picker/picker.go
+++ b/internal/picker/picker.go
@@ -5,14 +5,11 @@ import (
"github.com/ChausseBenjamin/termpicker/internal/colors"
"github.com/ChausseBenjamin/termpicker/internal/slider"
+ "github.com/ChausseBenjamin/termpicker/internal/ui"
"github.com/charmbracelet/bubbles/key"
tea "github.com/charmbracelet/bubbletea"
)
-const (
- activeRune = '>'
-)
-
type Model struct {
title string
active int
@@ -114,15 +111,19 @@ func (m Model) Init() tea.Cmd {
func (m Model) View() string {
var s string
- carriageReturn := ""
+ newline := ""
for i, slider := range m.sliders {
if i > 0 {
- carriageReturn = "\n"
+ newline = "\n"
}
if i == m.active {
- s += fmt.Sprintf("%v%c %s", carriageReturn, activeRune, slider.View())
+ s += fmt.Sprintf("%v%s %s",
+ newline,
+ ui.Style().PickerCursor.Render(ui.PickerSelRune),
+ slider.View(),
+ )
} else {
- s += fmt.Sprintf("%v %s", carriageReturn, slider.View())
+ s += fmt.Sprintf("%v %s", newline, slider.View())
}
}
return s