From e39b972ab489427ffa0f9b229e898c7c69c0c54d Mon Sep 17 00:00:00 2001 From: Benjamin Chausse Date: Sun, 24 Nov 2024 04:37:48 -0500 Subject: Different slider colors for hsl --- cmd/termpicker/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd/termpicker') diff --git a/cmd/termpicker/main.go b/cmd/termpicker/main.go index ef9f87f..6c666ee 100644 --- a/cmd/termpicker/main.go +++ b/cmd/termpicker/main.go @@ -40,7 +40,7 @@ func AppAction(ctx *cli.Context) error { // }}} // HSL {{{ h := slider.New('H', 360, progress.WithDefaultGradient()) - s := slider.New('S', 100, progress.WithDefaultGradient()) + s := slider.New('S', 100, progress.WithGradient("#95766f", "#f9370b")) l := slider.New('L', 100, progress.WithGradient("#222222", "#ffffff")) hsl := picker.New([]slider.Model{h, s, l}, "HSL") // }}} -- cgit v1.2.3 From 68cadf7720c11a4990b17cf682fb05f8b8be5138 Mon Sep 17 00:00:00 2001 From: Benjamin Chausse Date: Sun, 24 Nov 2024 04:44:13 -0500 Subject: Centralize pickers --- cmd/termpicker/main.go | 24 +++--------------------- internal/picker/defaults.go | 31 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 21 deletions(-) create mode 100644 internal/picker/defaults.go (limited to 'cmd/termpicker') diff --git a/cmd/termpicker/main.go b/cmd/termpicker/main.go index 6c666ee..241adcf 100644 --- a/cmd/termpicker/main.go +++ b/cmd/termpicker/main.go @@ -5,10 +5,8 @@ import ( "os" "github.com/ChausseBenjamin/termpicker/internal/picker" - "github.com/ChausseBenjamin/termpicker/internal/slider" "github.com/ChausseBenjamin/termpicker/internal/switcher" "github.com/ChausseBenjamin/termpicker/internal/util" - "github.com/charmbracelet/bubbles/progress" tea "github.com/charmbracelet/bubbletea" "github.com/urfave/cli/v2" ) @@ -25,25 +23,9 @@ func AppAction(ctx *cli.Context) error { slog.SetDefault(slog.New(handler)) slog.Info("Starting Termpicker") - // RGB {{{ - 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 := picker.New([]slider.Model{r, g, b}, "RGB") - // }}} - // CYMK {{{ - 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 := picker.New([]slider.Model{c, m, y, k}, "CMYK") - // }}} - // HSL {{{ - h := slider.New('H', 360, progress.WithDefaultGradient()) - s := slider.New('S', 100, progress.WithGradient("#95766f", "#f9370b")) - l := slider.New('L', 100, progress.WithGradient("#222222", "#ffffff")) - hsl := picker.New([]slider.Model{h, s, l}, "HSL") - // }}} + rgb := picker.RGB() + cmyk := picker.CMYK() + hsl := picker.HSL() sw := switcher.New([]picker.Model{*rgb, *cmyk, *hsl}) p := tea.NewProgram(sw) if _, err := p.Run(); err != nil { diff --git a/internal/picker/defaults.go b/internal/picker/defaults.go new file mode 100644 index 0000000..be41b1b --- /dev/null +++ b/internal/picker/defaults.go @@ -0,0 +1,31 @@ +package picker + +import ( + "github.com/ChausseBenjamin/termpicker/internal/slider" + "github.com/charmbracelet/bubbles/progress" +) + +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 +} + +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 +} + +func HSL() *Model { + h := slider.New('H', 360, progress.WithDefaultGradient()) + s := slider.New('S', 100, progress.WithGradient("#95766f", "#f9370b")) + l := slider.New('L', 100, progress.WithGradient("#222222", "#ffffff")) + hsl := New([]slider.Model{h, s, l}, "HSL") + return hsl +} -- cgit v1.2.3