-
Notifications
You must be signed in to change notification settings - Fork 0
/
theme.go
51 lines (45 loc) · 1.58 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
package internal
import (
"encoding/json"
"log"
"os"
)
type Theme struct {
FeedNames []string `json:"feedNames"`
Date string `json:"date"`
Time string `json:"time"`
ArticleBorder string `json:"articleBorder"`
PreviewBorder string `json:"previewBorder"`
FeedBorder string `json:"feedBorder"`
ArticleBorderTitle string `json:"articleBorderTitle"`
FeedBorderTitle string `json:"feedBorderTitle"`
PreviewBorderTitle string `json:"previewBorderTitle"`
Highlights string `json:"highlights"`
TableHead string `json:"tableHead"`
Title string `json:"title"`
UnreadFeedName string `json:"unreadFeedName"`
TotalColumn string `json:"totalColumn"`
UnreadColumn string `json:"unreadColumn"`
PreviewText string `json:"previewText"`
PreviewLink string `json:"previewLink"`
ReadMarker string `json:"readMarker"`
FeedIcon string `json:"feedIcon"`
ArticleIcon string `json:"articleIcon"`
PreviewIcon string `json:"previewIcon"`
StatusBackground string `json:"statusBackground"`
StatusText string `json:"statusText"`
StatusKey string `json:"statusKey"`
StatusBrackets string `json:"statusBrackets"`
}
func (t *Theme) LoadTheme(file string) {
tf, err := os.Open(file)
defer tf.Close()
if err != nil {
log.Fatal("Can't open theme file:", err)
}
jsonParser := json.NewDecoder(tf)
err = jsonParser.Decode(t)
if err != nil {
log.Fatal("Failed to parse theme file:", err)
}
}