-
Notifications
You must be signed in to change notification settings - Fork 180
/
styles.go
58 lines (49 loc) 路 1.29 KB
/
styles.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
package common
import (
"github.com/charmbracelet/lipgloss"
"github.com/dlvhdr/gh-dash/ui/constants"
"github.com/dlvhdr/gh-dash/ui/theme"
)
var (
SearchHeight = 3
FooterHeight = 1
ExpandedHelpHeight = 11
InputBoxHeight = 8
SingleRuneWidth = 4
MainContentPadding = 1
TabsBorderHeight = 1
TabsContentHeight = 2
TabsHeight = TabsBorderHeight + TabsContentHeight
ViewSwitcherMargin = 1
TableHeaderHeight = 2
)
type CommonStyles struct {
MainTextStyle lipgloss.Style
FooterStyle lipgloss.Style
ErrorStyle lipgloss.Style
WaitingGlyph string
FailureGlyph string
SuccessGlyph string
}
func BuildStyles(theme theme.Theme) CommonStyles {
var s CommonStyles
s.MainTextStyle = lipgloss.NewStyle().
Foreground(theme.PrimaryText).
Bold(true)
s.FooterStyle = lipgloss.NewStyle().
Background(theme.SelectedBackground).
Height(FooterHeight)
s.ErrorStyle = s.FooterStyle.Copy().
Foreground(theme.WarningText).
MaxHeight(FooterHeight)
s.WaitingGlyph = lipgloss.NewStyle().
Foreground(theme.FaintText).
Render(constants.WaitingIcon)
s.FailureGlyph = lipgloss.NewStyle().
Foreground(theme.WarningText).
Render(constants.FailureIcon)
s.SuccessGlyph = lipgloss.NewStyle().
Foreground(theme.SuccessText).
Render(constants.SuccessIcon)
return s
}