Skip to content

Commit 7126b45

Browse files
committed
menu: use catppuccin/mocha by default
1 parent f6e5725 commit 7126b45

3 files changed

Lines changed: 36 additions & 2 deletions

File tree

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module github.com/antonjah/ssm
33
go 1.24.0
44

55
require (
6+
github.com/catppuccin/go v0.3.0
67
github.com/charmbracelet/bubbles v0.21.0
78
github.com/charmbracelet/bubbletea v1.3.10
89
github.com/charmbracelet/lipgloss v1.1.0

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiE
44
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
55
github.com/aymanbagabas/go-udiff v0.2.0 h1:TK0fH4MteXUDspT88n8CKzvK0X9O2xu9yQjWpi6yML8=
66
github.com/aymanbagabas/go-udiff v0.2.0/go.mod h1:RE4Ex0qsGkTAJoQdQQCA0uG+nAzJO/pI/QwceO5fgrA=
7+
github.com/catppuccin/go v0.3.0 h1:d+0/YicIq+hSTo5oPuRi5kOpqkVA5tAsU6dNhvRu+aY=
8+
github.com/catppuccin/go v0.3.0/go.mod h1:8IHJuMGaUUjQM82qBrGNBv7LFq6JI3NnQCF6MOlZjpc=
79
github.com/charmbracelet/bubbles v0.21.0 h1:9TdC97SdRVg/1aaXNVWfFH3nnLAwOXr8Fn6u6mfQdFs=
810
github.com/charmbracelet/bubbles v0.21.0/go.mod h1:HF+v6QUR4HkEpz62dx7ym2xc71/KBHg+zKwJtMw+qtg=
911
github.com/charmbracelet/bubbletea v1.3.10 h1:otUDHWMMzQSB0Pkc87rm691KZ3SWa4KUlvF9nRvCICw=

internal/menu/menu.go

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313

1414
"github.com/antonjah/ssm/internal/config"
1515

16+
catppuccin "github.com/catppuccin/go"
1617
"github.com/charmbracelet/bubbles/help"
1718
"github.com/charmbracelet/bubbles/key"
1819
"github.com/charmbracelet/bubbles/list"
@@ -22,6 +23,9 @@ import (
2223
"golang.org/x/text/language"
2324
)
2425

26+
// Use Catppuccin Mocha flavor
27+
var mocha = catppuccin.Mocha
28+
2529
var docStyle = lipgloss.NewStyle().Margin(1, 2)
2630

2731
var titleCaser = cases.Title(language.English)
@@ -70,6 +74,23 @@ type customDelegate struct {
7074

7175
func newCustomDelegate() customDelegate {
7276
d := list.NewDefaultDelegate()
77+
78+
// Apply Catppuccin Mocha colors
79+
d.Styles.SelectedTitle = d.Styles.SelectedTitle.
80+
Foreground(lipgloss.Color(mocha.Mauve().Hex)).
81+
BorderForeground(lipgloss.Color(mocha.Mauve().Hex))
82+
d.Styles.SelectedDesc = d.Styles.SelectedDesc.
83+
Foreground(lipgloss.Color(mocha.Subtext0().Hex)).
84+
BorderForeground(lipgloss.Color(mocha.Mauve().Hex))
85+
d.Styles.NormalTitle = d.Styles.NormalTitle.
86+
Foreground(lipgloss.Color(mocha.Text().Hex))
87+
d.Styles.NormalDesc = d.Styles.NormalDesc.
88+
Foreground(lipgloss.Color(mocha.Subtext1().Hex))
89+
d.Styles.DimmedTitle = d.Styles.DimmedTitle.
90+
Foreground(lipgloss.Color(mocha.Overlay0().Hex))
91+
d.Styles.DimmedDesc = d.Styles.DimmedDesc.
92+
Foreground(lipgloss.Color(mocha.Overlay0().Hex))
93+
7394
return customDelegate{defaultDelegate: d}
7495
}
7596

@@ -168,6 +189,15 @@ func NewModel(hosts []config.Host) Model {
168189
hostList.SetFilteringEnabled(true)
169190
hostList.SetShowTitle(false)
170191

192+
// Apply Catppuccin Mocha colors to list styles
193+
hostList.Styles.Title = hostList.Styles.Title.
194+
Foreground(lipgloss.Color(mocha.Mauve().Hex)).
195+
Bold(true)
196+
hostList.Styles.FilterPrompt = hostList.Styles.FilterPrompt.
197+
Foreground(lipgloss.Color(mocha.Mauve().Hex))
198+
hostList.Styles.FilterCursor = hostList.Styles.FilterCursor.
199+
Foreground(lipgloss.Color(mocha.Pink().Hex))
200+
171201
return Model{
172202
list: hostList,
173203
help: help.New(),
@@ -233,8 +263,9 @@ func (m Model) View() string {
233263
Margin(1, 2).
234264
Padding(1, 2).
235265
Border(lipgloss.RoundedBorder()).
236-
BorderForeground(lipgloss.Color("5")).
237-
Foreground(lipgloss.Color("#FFFFFF")).
266+
BorderForeground(lipgloss.Color(mocha.Mauve().Hex)).
267+
Foreground(lipgloss.Color(mocha.Text().Hex)).
268+
Background(lipgloss.Color(mocha.Base().Hex)).
238269
Width(60) // Fixed width for better centering
239270

240271
styledPopup := popupStyle.Render(popupContent)

0 commit comments

Comments
 (0)