-
-
Notifications
You must be signed in to change notification settings - Fork 588
/
styles.go
90 lines (82 loc) · 2.81 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
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
package globalconfig
import (
"github.com/jedib0t/go-pretty/v6/table"
"github.com/jedib0t/go-pretty/v6/text"
)
var (
FormatOptionsDefault = table.FormatOptions{
//Footer: text.FormatUpper,
Header: text.FormatUpper,
Row: text.FormatDefault,
}
DdevDefaultStyle = table.Style{
Name: "StyleLight",
Box: table.StyleBoxLight,
Color: table.ColorOptionsDefault,
Format: FormatOptionsDefault,
HTML: table.DefaultHTMLOptions,
Options: OptionsSeparateRows,
Title: table.TitleOptionsDefault,
}
DdevStyleBold = table.Style{
Name: "StyleBold",
Box: table.StyleBoxBold,
Color: table.ColorOptionsDefault,
Format: FormatOptionsDefault,
HTML: table.DefaultHTMLOptions,
Options: table.OptionsDefault,
Title: table.TitleOptionsDefault,
}
DdevStyleColoredBright = table.Style{
Name: "StyleColoredBright",
Box: table.StyleBoxDefault,
Color: table.ColorOptionsBright,
Format: FormatOptionsDefault,
HTML: table.DefaultHTMLOptions,
Options: table.OptionsNoBordersAndSeparators,
Title: table.TitleOptionsDark,
}
)
// StyleMap give the list of available styles
var StyleMap = map[string]table.Style{
"default": DdevDefaultStyle,
"bold": DdevStyleBold,
"bright": DdevStyleColoredBright,
//"StyleDouble": table.StyleDouble,
//"StyleRounded": table.StyleRounded,
//"StyleColoredDark": table.StyleColoredDark,
//"StyleColoredBlackOnBlueWhite": table.StyleColoredBlackOnBlueWhite,
//"StyleColoredBlackOnCyanWhite": table.StyleColoredBlackOnCyanWhite,
//"StyleColoredBlackOnGreenWhite": table.StyleColoredBlackOnGreenWhite,
//"StyleColoredBlackOnMagentaWhite": table.StyleColoredBlackOnMagentaWhite,
//"StyleColoredBlackOnYellowWhite": table.StyleColoredBlackOnYellowWhite,
//"StyleColoredBlackOnRedWhite": table.StyleColoredBlackOnRedWhite,
//"StyleColoredBlueWhiteOnBlack": table.StyleColoredBlueWhiteOnBlack,
//"StyleColoredCyanWhiteOnBlack": table.StyleColoredCyanWhiteOnBlack,
//"StyleColoredGreenWhiteOnBlack": table.StyleColoredGreenWhiteOnBlack,
//"StyleColoredMagentaWhiteOnBlack": table.StyleColoredMagentaWhiteOnBlack,
//"StyleColoredRedWhiteOnBlack": table.StyleColoredRedWhiteOnBlack,
//"StyleColoredYellowWhiteOnBlack": table.StyleColoredYellowWhiteOnBlack,
}
var OptionsSeparateRows = table.Options{
DrawBorder: true,
SeparateColumns: true,
SeparateFooter: true,
SeparateHeader: true,
SeparateRows: true,
}
// IsValidTableStyle checks to see if the table style is valid
func IsValidTableStyle(style string) bool {
if _, ok := StyleMap[style]; ok {
return true
}
return false
}
// ValidTableStyleList returns an array of valid styles
func ValidTableStyleList() []string {
list := []string{}
for k := range StyleMap {
list = append(list, k)
}
return list
}