-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththeme.go
More file actions
72 lines (67 loc) · 2.52 KB
/
Copy paththeme.go
File metadata and controls
72 lines (67 loc) · 2.52 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
package laslig
import "charm.land/lipgloss/v2"
// Theme contains the styles used by one printer.
type Theme struct {
Section lipgloss.Style
Label lipgloss.Style
Value lipgloss.Style
Identifier lipgloss.Style
Muted lipgloss.Style
Badge lipgloss.Style
Panel lipgloss.Style
TableHeader lipgloss.Style
TableRule lipgloss.Style
NoticeInfo lipgloss.Style
NoticeSuccess lipgloss.Style
NoticeWarning lipgloss.Style
NoticeError lipgloss.Style
}
// DefaultTheme returns the default theme for one resolved output mode.
func DefaultTheme(mode Mode) Theme {
base := lipgloss.NewStyle()
if !mode.Styled {
return Theme{
Section: base,
Label: base,
Value: base,
Identifier: base,
Muted: base,
Badge: base,
Panel: base,
TableHeader: base,
TableRule: base,
NoticeInfo: base,
NoticeSuccess: base,
NoticeWarning: base,
NoticeError: base,
}
}
heading := lipgloss.Color("69")
label := lipgloss.Color("109")
identifier := lipgloss.Color("81")
accent := lipgloss.Color("62")
border := lipgloss.Color("63")
text := lipgloss.Color("252")
muted := lipgloss.Color("245")
success := lipgloss.Color("#04B575")
warning := lipgloss.Color("214")
errorColor := lipgloss.Color("160")
info := lipgloss.Color("69")
badgeText := lipgloss.Color("230")
warningText := lipgloss.Color("232")
return Theme{
Section: lipgloss.NewStyle().Bold(true).Underline(true).Foreground(heading),
Label: lipgloss.NewStyle().Bold(true).Foreground(label),
Value: lipgloss.NewStyle().Foreground(text),
Identifier: lipgloss.NewStyle().Bold(true).Foreground(identifier),
Muted: lipgloss.NewStyle().Foreground(muted),
Badge: lipgloss.NewStyle().Bold(true).Foreground(badgeText).Background(accent).Padding(0, 1),
Panel: lipgloss.NewStyle().Border(lipgloss.RoundedBorder()).BorderForeground(border).Foreground(text).Padding(1, 2),
TableHeader: lipgloss.NewStyle().Bold(true).Foreground(heading),
TableRule: lipgloss.NewStyle().Foreground(border),
NoticeInfo: lipgloss.NewStyle().Bold(true).Foreground(badgeText).Background(info).Padding(0, 1),
NoticeSuccess: lipgloss.NewStyle().Bold(true).Foreground(badgeText).Background(success).Padding(0, 1),
NoticeWarning: lipgloss.NewStyle().Bold(true).Foreground(warningText).Background(warning).Padding(0, 1),
NoticeError: lipgloss.NewStyle().Bold(true).Foreground(badgeText).Background(errorColor).Padding(0, 1),
}
}