-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththeme.go
More file actions
83 lines (66 loc) · 2.82 KB
/
theme.go
File metadata and controls
83 lines (66 loc) · 2.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package main
import "charm.land/lipgloss/v2"
// ── Colour palette ─────────────────────────────────────────────────
var (
accent = lipgloss.Color("212") // pink
secondary = lipgloss.Color("99") // lavender
dim = lipgloss.Color("240") // grey
bright = lipgloss.Color("252") // near-white
success = lipgloss.Color("78") // green
danger = lipgloss.Color("196") // red
warning = lipgloss.Color("220") // yellow
override = lipgloss.Color("222") // warm yellow — per-package rule indicator
)
// ── Menu / list items ──────────────────────────────────────────────
var (
itemStyle = lipgloss.NewStyle().
Foreground(bright)
itemActiveStyle = lipgloss.NewStyle().
Bold(true).
Foreground(accent)
itemDescStyle = lipgloss.NewStyle().
Foreground(dim)
cursorStr = lipgloss.NewStyle().Foreground(accent).Bold(true).Render("▸ ")
cursorBlankStr = " "
)
// ── Section titles ─────────────────────────────────────────────────
var sectionTitleStyle = lipgloss.NewStyle().
Bold(true).
Foreground(secondary).
MarginBottom(1)
// ── Status / feedback ──────────────────────────────────────────────
var (
infoStyle = lipgloss.NewStyle().Foreground(secondary)
successStyle = lipgloss.NewStyle().Foreground(success).Bold(true)
errorStyle = lipgloss.NewStyle().Foreground(danger).Bold(true)
warnStyle = lipgloss.NewStyle().Foreground(warning)
helpStyle = lipgloss.NewStyle().Foreground(dim)
)
// ── Helpers ────────────────────────────────────────────────────────
func checkbox(checked bool) string {
if checked {
return lipgloss.NewStyle().Foreground(accent).Bold(true).Render("[✓]")
}
return lipgloss.NewStyle().Foreground(dim).Render("[ ]")
}
func indentBlock(block string, spaces int) string {
return lipgloss.NewStyle().MarginLeft(spaces).Render(block)
}
func useCompactHeaderForSize(width, height int) bool {
return height < 32 || width < 110
}
func contentAreaHeightForWindow(width, height int, hasHelp bool) int {
chromeHeight := 11 // full logo (6) + subtitle (1) + bordered tabs (3) + padding (1)
if useCompactHeaderForSize(width, height) {
chromeHeight = 5 // compact title (1) + bordered tabs (3) + padding (1)
}
helpHeight := 0
if hasHelp {
helpHeight = 1
}
contentHeight := height - chromeHeight - helpHeight - 1
if contentHeight < 1 {
return 1
}
return contentHeight
}