feat(config): add theme field (#134)

This commit is contained in:
ayntgl 2022-03-06 17:24:19 +04:00 • committed by GitHub
parent 89b622ec0d
commit 20ca8a7268
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 1 deletions

View file

@ -8,13 +8,15 @@ import (
)
type Config struct {
Keybindings KeybindingsConfig `toml:"keybindings"`
General GeneralConfig `toml:"general"`
Theme ThemeConfig `toml:"theme"`
Keybindings KeybindingsConfig `toml:"keybindings"`
}
func newConfig() Config {
return Config{
General: newGeneralConfig(),
Theme: newThemeConfig(),
Keybindings: newKeybindingsConfig(),
}
}

15
config/theme.go Normal file
View file

@ -0,0 +1,15 @@
package config
type ThemeConfig struct {
Background string `toml:"background"`
Border string `toml:"border"`
Title string `toml:"title"`
}
func newThemeConfig() ThemeConfig {
return ThemeConfig{
Background: "black",
Border: "white",
Title: "white",
}
}

View file

@ -5,6 +5,7 @@ import (
"github.com/ayntgl/discordo/discord"
"github.com/ayntgl/discordo/ui"
"github.com/gdamore/tcell/v2"
"github.com/rivo/tview"
"github.com/zalando/go-keyring"
)
@ -95,6 +96,10 @@ func main() {
tview.Borders.Horizontal = 0
tview.Borders.Vertical = 0
tview.Styles.PrimitiveBackgroundColor = tcell.GetColor(app.Config.Theme.Background)
tview.Styles.BorderColor = tcell.GetColor(app.Config.Theme.Border)
tview.Styles.TitleColor = tcell.GetColor(app.Config.Theme.Title)
err := app.Run()
if err != nil {
panic(err)