-
Notifications
You must be signed in to change notification settings - Fork 1
/
theme.go
103 lines (93 loc) · 2.15 KB
/
theme.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
package tooey
import (
"github.com/gdamore/tcell/v2"
)
const (
DefaultULCorner = tcell.RuneULCorner
DefaultURCorner = tcell.RuneURCorner
DefaultLLCorner = tcell.RuneLLCorner
DefaultLRCorner = tcell.RuneLRCorner
DefaultHLine = tcell.RuneHLine
DefaultVLine = tcell.RuneVLine
)
// Chars is to enable theming border characters
type Chars struct {
HLine rune
VLine rune
ULCorner rune
URCorner rune
LLCorner rune
LRCorner rune
}
// NewDefaultChars returns the default character set
// for borders
func NewDefaultChars() *Chars {
return &Chars{
HLine: DefaultHLine,
VLine: DefaultVLine,
ULCorner: DefaultULCorner,
URCorner: DefaultURCorner,
LLCorner: DefaultLLCorner,
LRCorner: DefaultLRCorner,
}
}
var DefaultStylized = &Chars{
HLine: DefaultHLine,
VLine: DefaultVLine,
ULCorner: '╒',
URCorner: DefaultURCorner,
LLCorner: DefaultLLCorner,
LRCorner: DefaultLRCorner,
}
// RoundedBarBorderChars is like the Default border but the
// corners are rounded
var RoundedBarBorderChars = &Chars{
HLine: DefaultHLine,
VLine: DefaultVLine,
ULCorner: '╭',
URCorner: '╮',
LLCorner: '╰',
LRCorner: '╯',
}
// CornersOnlyBorderChars will only render corners
// with triangle ascii
var CornersOnlyBorderChars = &Chars{
HLine: ' ',
VLine: ' ',
ULCorner: '◤',
URCorner: '◥',
LLCorner: '◣',
LRCorner: '◢',
}
// DoubleBarBorder is like the Default border but with
// double bars for more dramatic effect // rune(2550)
var DoubleBarBorderChars = &Chars{
HLine: '═',
VLine: '║',
ULCorner: '╔',
URCorner: '╗',
LLCorner: '╚',
LRCorner: '╝',
}
/*
Theme is a bundle of Styles for different elements, subelements, and widgets
If Inherit is true in the theme, then when a theme is set it will propagate the Default
down to the others
*/
type Theme struct {
Default Style
Element Style
Border Style
Title Style
Text Style
Chars *Chars
}
// DefaultTheme is a basic white foreground and black background for all elements
var DefaultTheme = &Theme{
Default: StyleDefault,
Element: StyleClear,
Border: StyleDefault,
Title: StyleDefault,
Text: StyleDefault,
Chars: NewDefaultChars(),
}