Start with dark and light themes
This commit is contained in:
parent
72eaefe23b
commit
7a9bfce4ed
@ -3,16 +3,21 @@ package config
|
||||
import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
|
||||
"github.com/gizak/termui"
|
||||
)
|
||||
|
||||
// Config is the definition of a Config struct
|
||||
type Config struct {
|
||||
SlackToken string `json:"slack_token"`
|
||||
Theme string `json:"theme"`
|
||||
}
|
||||
|
||||
// NewConfig loads the config file and returns a Config struct
|
||||
func NewConfig(filepath string) (*Config, error) {
|
||||
var cfg Config
|
||||
cfg := Config{
|
||||
Theme: "dark",
|
||||
}
|
||||
|
||||
file, err := os.Open(filepath)
|
||||
if err != nil {
|
||||
@ -23,5 +28,16 @@ func NewConfig(filepath string) (*Config, error) {
|
||||
return &cfg, err
|
||||
}
|
||||
|
||||
if cfg.Theme == "light" {
|
||||
termui.ColorMap = map[string]termui.Attribute{
|
||||
"fg": termui.ColorBlack,
|
||||
"bg": termui.ColorDefault,
|
||||
"border.fg": termui.ColorBlack,
|
||||
"label.fg": termui.ColorGreen,
|
||||
"par.fg": termui.ColorYellow,
|
||||
"par.label.bg": termui.ColorWhite,
|
||||
}
|
||||
}
|
||||
|
||||
return &cfg, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user