Pointerize Config.Theme

This commit is contained in:
rigormorrtiss 2021-08-23 12:40:28 +04:00
parent e1a88777a7
commit a3e9fbd076
2 changed files with 7 additions and 5 deletions

View file

@ -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).

View file

@ -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.