-
-
Notifications
You must be signed in to change notification settings - Fork 50
/
style.go
154 lines (143 loc) · 6.19 KB
/
style.go
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
package main
import "github.com/charmbracelet/lipgloss"
// SnippetsStyle is the style struct to handle the focusing and blurring of the
// snippets pane in the application.
type SnippetsStyle struct {
Focused SnippetsBaseStyle
Blurred SnippetsBaseStyle
}
// FoldersStyle is the style struct to handle the focusing and blurring of the
// folders pane in the application.
type FoldersStyle struct {
Focused FoldersBaseStyle
Blurred FoldersBaseStyle
}
// ContentStyle is the style struct to handle the focusing and blurring of the
// content pane in the application.
type ContentStyle struct {
Focused ContentBaseStyle
Blurred ContentBaseStyle
}
// SnippetsBaseStyle holds the neccessary styling for the snippets pane of
// the application.
type SnippetsBaseStyle struct {
Base lipgloss.Style
Title lipgloss.Style
TitleBar lipgloss.Style
SelectedSubtitle lipgloss.Style
UnselectedSubtitle lipgloss.Style
SelectedTitle lipgloss.Style
UnselectedTitle lipgloss.Style
CopiedTitleBar lipgloss.Style
CopiedTitle lipgloss.Style
CopiedSubtitle lipgloss.Style
DeletedTitleBar lipgloss.Style
DeletedTitle lipgloss.Style
DeletedSubtitle lipgloss.Style
}
// FoldersBaseStyle holds the neccessary styling for the folders pane of
// the application.
type FoldersBaseStyle struct {
Base lipgloss.Style
Title lipgloss.Style
TitleBar lipgloss.Style
Selected lipgloss.Style
Unselected lipgloss.Style
}
// ContentBaseStyle holds the neccessary styling for the content pane of the
// application.
type ContentBaseStyle struct {
Base lipgloss.Style
Title lipgloss.Style
Separator lipgloss.Style
LineNumber lipgloss.Style
EmptyHint lipgloss.Style
EmptyHintKey lipgloss.Style
}
// Styles is the struct of all styles for the application.
type Styles struct {
Snippets SnippetsStyle
Folders FoldersStyle
Content ContentStyle
}
var marginStyle = lipgloss.NewStyle().Margin(1, 0, 0, 1)
// DefaultStyles is the default implementation of the styles struct for all
// styling in the application.
func DefaultStyles(config Config) Styles {
white := lipgloss.Color(config.WhiteColor)
gray := lipgloss.Color(config.GrayColor)
black := lipgloss.Color(config.BackgroundColor)
brightBlack := lipgloss.Color(config.BlackColor)
green := lipgloss.Color(config.GreenColor)
brightGreen := lipgloss.Color(config.BrightGreenColor)
brightBlue := lipgloss.Color(config.PrimaryColor)
blue := lipgloss.Color(config.PrimaryColorSubdued)
red := lipgloss.Color(config.RedColor)
brightRed := lipgloss.Color(config.BrightRedColor)
return Styles{
Snippets: SnippetsStyle{
Focused: SnippetsBaseStyle{
Base: lipgloss.NewStyle().Width(35),
TitleBar: lipgloss.NewStyle().Background(blue).Width(35-2).Margin(0, 1, 1, 1).Padding(0, 1).Foreground(white),
SelectedSubtitle: lipgloss.NewStyle().Foreground(blue),
UnselectedSubtitle: lipgloss.NewStyle().Foreground(lipgloss.Color("237")),
SelectedTitle: lipgloss.NewStyle().Foreground(brightBlue),
UnselectedTitle: lipgloss.NewStyle().Foreground(gray),
CopiedTitleBar: lipgloss.NewStyle().Background(green).Width(35-2).Margin(0, 1, 1, 1).Padding(0, 1).Foreground(white),
CopiedTitle: lipgloss.NewStyle().Foreground(brightGreen),
CopiedSubtitle: lipgloss.NewStyle().Foreground(green),
DeletedTitleBar: lipgloss.NewStyle().Background(red).Width(35-2).Margin(0, 1, 1, 1).Padding(0, 1).Foreground(white),
DeletedTitle: lipgloss.NewStyle().Foreground(brightRed),
DeletedSubtitle: lipgloss.NewStyle().Foreground(red),
},
Blurred: SnippetsBaseStyle{
Base: lipgloss.NewStyle().Width(35),
TitleBar: lipgloss.NewStyle().Background(black).Width(35-2).Margin(0, 1, 1, 1).Padding(0, 1).Foreground(gray),
SelectedSubtitle: lipgloss.NewStyle().Foreground(blue),
UnselectedSubtitle: lipgloss.NewStyle().Foreground(black),
SelectedTitle: lipgloss.NewStyle().Foreground(brightBlue),
UnselectedTitle: lipgloss.NewStyle().Foreground(lipgloss.Color("237")),
CopiedTitleBar: lipgloss.NewStyle().Background(green).Width(35-2).Margin(0, 1, 1, 1).Padding(0, 1),
CopiedTitle: lipgloss.NewStyle().Foreground(brightGreen),
CopiedSubtitle: lipgloss.NewStyle().Foreground(green),
DeletedTitleBar: lipgloss.NewStyle().Background(red).Width(35-2).Margin(0, 1, 1, 1).Padding(0, 1),
DeletedTitle: lipgloss.NewStyle().Foreground(brightRed),
DeletedSubtitle: lipgloss.NewStyle().Foreground(red),
},
},
Folders: FoldersStyle{
Focused: FoldersBaseStyle{
Base: lipgloss.NewStyle().Width(22),
Title: lipgloss.NewStyle().Padding(0, 1).Foreground(white),
TitleBar: lipgloss.NewStyle().Background(blue).Width(22-2).Margin(0, 1, 1, 1),
Selected: lipgloss.NewStyle().Foreground(brightBlue),
Unselected: lipgloss.NewStyle().Foreground(gray),
},
Blurred: FoldersBaseStyle{
Base: lipgloss.NewStyle().Width(22),
Title: lipgloss.NewStyle().Padding(0, 1).Foreground(gray),
TitleBar: lipgloss.NewStyle().Background(black).Width(22-2).Margin(0, 1, 1, 1),
Selected: lipgloss.NewStyle().Foreground(brightBlue),
Unselected: lipgloss.NewStyle().Foreground(lipgloss.Color("237")),
},
},
Content: ContentStyle{
Focused: ContentBaseStyle{
Base: lipgloss.NewStyle().Margin(0, 1),
Title: lipgloss.NewStyle().Background(blue).Foreground(white).Margin(0, 0, 1, 1).Padding(0, 1),
Separator: lipgloss.NewStyle().Foreground(white).Margin(0, 0, 1, 1),
LineNumber: lipgloss.NewStyle().Foreground(brightBlack),
EmptyHint: lipgloss.NewStyle().Foreground(gray),
EmptyHintKey: lipgloss.NewStyle().Foreground(brightBlue),
},
Blurred: ContentBaseStyle{
Base: lipgloss.NewStyle().Margin(0, 1),
Title: lipgloss.NewStyle().Background(black).Foreground(gray).Margin(0, 0, 1, 1).Padding(0, 1),
Separator: lipgloss.NewStyle().Foreground(gray).Margin(0, 0, 1, 1),
LineNumber: lipgloss.NewStyle().Foreground(black),
EmptyHint: lipgloss.NewStyle().Foreground(gray),
EmptyHintKey: lipgloss.NewStyle().Foreground(brightBlue),
},
},
}
}