feat(config): add theme field (#134)
This commit is contained in:
parent
89b622ec0d
commit
20ca8a7268
3 changed files with 23 additions and 1 deletions
|
|
@ -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
15
config/theme.go
Normal 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",
|
||||
}
|
||||
}
|
||||
5
main.go
5
main.go
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue