From a3e9fbd0769189b48a9566ef34b4b5fa72f57555 Mon Sep 17 00:00:00 2001 From: rigormorrtiss Date: Mon, 23 Aug 2021 12:40:28 +0400 Subject: [PATCH] Pointerize Config.Theme --- discordo.go | 4 +++- util/config.go | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/discordo.go b/discordo.go index 82516cc..c4dedbf 100644 --- a/discordo.go +++ b/discordo.go @@ -29,7 +29,9 @@ var ( func main() { conf = util.NewConfig() - tview.Styles = conf.Theme + if conf.Theme != nil { + tview.Styles = *conf.Theme + } app = tview.NewApplication(). EnableMouse(conf.Mouse). diff --git a/util/config.go b/util/config.go index 4af6cda..20297c9 100644 --- a/util/config.go +++ b/util/config.go @@ -9,10 +9,10 @@ import ( // Config consists of fields, such as theme, mouse, so on, that may be customized by the user. type Config struct { - Token string `json:"token,omitempty"` - Mouse bool `json:"mouse,omitempty"` - GetMessagesLimit int `json:"getMessagesLimit,omitempty"` - Theme tview.Theme `json:"theme,omitempty"` + Token string `json:"token,omitempty"` + Mouse bool `json:"mouse,omitempty"` + GetMessagesLimit int `json:"getMessagesLimit,omitempty"` + Theme *tview.Theme `json:"theme,omitempty"` } // NewConfig reads the configuration file (if exists) and returns a new config.