util: add theme.borders option to config (#32)
This commit is contained in:
parent
4bf8085239
commit
c22a64cc5d
2 changed files with 31 additions and 18 deletions
36
discordo.go
36
discordo.go
|
|
@ -32,22 +32,32 @@ var (
|
|||
)
|
||||
|
||||
func main() {
|
||||
tview.Borders.HorizontalFocus = tview.Borders.Horizontal
|
||||
tview.Borders.VerticalFocus = tview.Borders.Vertical
|
||||
tview.Borders.TopLeftFocus = tview.Borders.TopLeft
|
||||
tview.Borders.TopRightFocus = tview.Borders.TopRight
|
||||
tview.Borders.BottomLeftFocus = tview.Borders.BottomLeft
|
||||
tview.Borders.BottomRightFocus = tview.Borders.BottomRight
|
||||
tview.Borders.Horizontal = ' '
|
||||
tview.Borders.Vertical = ' '
|
||||
tview.Borders.TopLeft = ' '
|
||||
tview.Borders.TopRight = ' '
|
||||
tview.Borders.BottomLeft = ' '
|
||||
tview.Borders.BottomRight = ' '
|
||||
|
||||
conf = util.NewConfig()
|
||||
|
||||
tview.Styles.PrimitiveBackgroundColor = tcell.GetColor(conf.Theme.Background)
|
||||
|
||||
if !conf.Theme.Borders {
|
||||
tview.Borders = struct {
|
||||
Horizontal rune
|
||||
Vertical rune
|
||||
TopLeft rune
|
||||
TopRight rune
|
||||
BottomLeft rune
|
||||
BottomRight rune
|
||||
LeftT rune
|
||||
RightT rune
|
||||
TopT rune
|
||||
BottomT rune
|
||||
Cross rune
|
||||
HorizontalFocus rune
|
||||
VerticalFocus rune
|
||||
TopLeftFocus rune
|
||||
TopRightFocus rune
|
||||
BottomLeftFocus rune
|
||||
BottomRightFocus rune
|
||||
}{}
|
||||
}
|
||||
|
||||
app = ui.NewApp(onAppInputCapture)
|
||||
guildsTreeView = ui.NewGuildsTreeView(onGuildsTreeViewSelected)
|
||||
messagesTextView = ui.NewMessagesTextView(app)
|
||||
|
|
|
|||
|
|
@ -6,13 +6,14 @@ import (
|
|||
)
|
||||
|
||||
type Theme struct {
|
||||
Background string `json:"background"`
|
||||
Foreground string `json:"foreground"`
|
||||
Background string `json:"background,omitempty"`
|
||||
Foreground string `json:"foreground,omitempty"`
|
||||
Borders bool `json:"borders,omitempty"`
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
GetMessagesLimit uint `json:"getMessagesLimit"`
|
||||
Theme *Theme `json:"theme"`
|
||||
GetMessagesLimit uint `json:"getMessagesLimit,omitempty"`
|
||||
Theme *Theme `json:"theme,omitempty"`
|
||||
}
|
||||
|
||||
func NewConfig() *Config {
|
||||
|
|
@ -23,7 +24,9 @@ func NewConfig() *Config {
|
|||
|
||||
var c Config = Config{
|
||||
GetMessagesLimit: 50,
|
||||
Theme: &Theme{},
|
||||
Theme: &Theme{
|
||||
Borders: true,
|
||||
},
|
||||
}
|
||||
configPath := userHomeDir + "/.config/discordo/config.json"
|
||||
if _, err := os.Stat(configPath); os.IsNotExist(err) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue