Sfoglia il codice sorgente

Pointerize Config.Theme

rigormorrtiss 4 anni fa
parent
commit
a3e9fbd076
2 ha cambiato i file con 7 aggiunte e 5 eliminazioni
  1. 3 1
      discordo.go
  2. 4 4
      util/config.go

+ 3 - 1
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).

+ 4 - 4
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.