forked from wtfutil/wtf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault_color_theme.go
109 lines (88 loc) · 2.2 KB
/
default_color_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
104
105
106
107
108
109
package cfg
import (
"github.com/olebedev/config"
"gopkg.in/yaml.v2"
)
// BorderTheme defines the default color scheme for drawing widget borders
type BorderTheme struct {
Focusable string
Focused string
Unfocusable string
}
// CheckboxTheme defines the default color scheme for drawing checkable rows in widgets
type CheckboxTheme struct {
Checked string
}
// RowTheme defines the default color scheme for row text
type RowTheme struct {
EvenBackground string
EvenForeground string
OddBackground string
OddForeground string
HighlightedBackground string
HighlightedForeground string
}
// TextTheme defines the default color scheme for text rendering
type TextTheme struct {
Label string
Subheading string
Text string
Title string
}
// WidgetTheme defines the default color scheme for the widget rect itself
type WidgetTheme struct {
Background string
}
// ColorTheme is an alamgam of all the default color settings
type ColorTheme struct {
BorderTheme
CheckboxTheme
RowTheme
TextTheme
WidgetTheme
}
// NewDefaultColorTheme creates and returns an instance of DefaultColorTheme
func NewDefaultColorTheme() ColorTheme {
defaultTheme := ColorTheme{
BorderTheme: BorderTheme{
Focusable: "blue",
Focused: "orange",
Unfocusable: "gray",
},
CheckboxTheme: CheckboxTheme{
Checked: "gray",
},
RowTheme: RowTheme{
EvenBackground: "transparent",
EvenForeground: "white",
OddBackground: "transparent",
OddForeground: "lightblue",
HighlightedForeground: "black",
HighlightedBackground: "green",
},
TextTheme: TextTheme{
Label: "lightblue",
Subheading: "red",
Text: "white",
Title: "green",
},
WidgetTheme: WidgetTheme{
Background: "transparent",
},
}
return defaultTheme
}
// NewDefaultColorConfig creates and returns a config.Config-compatible configuration struct
// using a DefaultColorTheme to pre-populate all the relevant values
func NewDefaultColorConfig() (*config.Config, error) {
colorTheme := NewDefaultColorTheme()
yamlBytes, err := yaml.Marshal(colorTheme)
if err != nil {
return nil, err
}
cfg, err := config.ParseYamlBytes(yamlBytes)
if err != nil {
return nil, err
}
return cfg, nil
}