|
|
@@ -3,21 +3,16 @@ package util
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
"os"
|
|
|
-)
|
|
|
|
|
|
-// Theme defines the theme for the application.
|
|
|
-type Theme struct {
|
|
|
- Background string `json:"background,omitempty"`
|
|
|
- Foreground string `json:"foreground,omitempty"`
|
|
|
- Borders bool `json:"borders,omitempty"`
|
|
|
-}
|
|
|
+ "github.com/rivo/tview"
|
|
|
+)
|
|
|
|
|
|
// 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 *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.
|
|
|
@@ -30,9 +25,6 @@ func NewConfig() *Config {
|
|
|
var c Config = Config{
|
|
|
Mouse: true,
|
|
|
GetMessagesLimit: 50,
|
|
|
- Theme: &Theme{
|
|
|
- Borders: true,
|
|
|
- },
|
|
|
}
|
|
|
configPath := userHomeDir + "/.config/discordo/config.json"
|
|
|
if _, err := os.Stat(configPath); os.IsNotExist(err) {
|