-
Notifications
You must be signed in to change notification settings - Fork 53
/
base.go
51 lines (47 loc) · 1.12 KB
/
base.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
package tui
import (
"github.com/charmbracelet/bubbles/table"
"github.com/charmbracelet/lipgloss"
)
var (
BackgroundColor = lipgloss.CompleteColor{
TrueColor: "#3B4252",
ANSI256: "59",
ANSI: "4",
}
HeaderColor = lipgloss.CompleteColor{
TrueColor: "#5e81ac",
ANSI256: "67",
ANSI: "4",
}
SelectedColor = lipgloss.CompleteColor{
TrueColor: "#4C566A",
ANSI256: "60",
ANSI: "4",
}
BorderOutlineColor = lipgloss.CompleteColor{
TrueColor: "#8fbcbb",
ANSI256: "115",
ANSI: "6",
}
)
var BaseStyle = lipgloss.NewStyle().
BorderStyle(lipgloss.HiddenBorder()).
Background(BackgroundColor)
var SelectedStyle = table.DefaultStyles().Selected.Copy().
Background(SelectedColor).
Foreground(lipgloss.NoColor{})
var HeaderStyle = table.DefaultStyles().Header.Copy().
Background(HeaderColor).
Bold(true)
func NewTable(cols []table.Column, opts ...table.Option) table.Model {
t := table.New(append([]table.Option{
table.WithColumns(cols),
table.WithFocused(true),
}, opts...)...)
s := table.DefaultStyles()
s.Header = HeaderStyle
s.Selected = SelectedStyle
t.SetStyles(s)
return t
}