💄 Allow setting the theme

This commit is contained in:
Andreas Schneider 2021-03-06 14:24:21 +01:00
parent 79d322de14
commit e3e64309b6
1 changed files with 11 additions and 1 deletions

10
main.go
View File

@ -3,6 +3,7 @@ package main
import ( import (
"embed" "embed"
"encoding/json" "encoding/json"
"flag"
"fmt" "fmt"
"sync" "sync"
@ -18,6 +19,8 @@ import (
//go:embed data/gitmojis.json data/images //go:embed data/gitmojis.json data/images
var data embed.FS var data embed.FS
var preferredTheme = flag.String("theme", "light", "Specifiy the theme to be used. dark/light")
type Gitmoji struct { type Gitmoji struct {
Emoji string Emoji string
Code string Code string
@ -52,6 +55,8 @@ func newKeyedEntry() *keyedEntry {
} }
func main() { func main() {
flag.Parse()
gitmojiData, err := loadData() gitmojiData, err := loadData()
if err != nil { if err != nil {
// TODO show dialog // TODO show dialog
@ -59,7 +64,12 @@ func main() {
} }
a := app.New() a := app.New()
switch *preferredTheme {
case "dark":
a.Settings().SetTheme(theme.DarkTheme())
default:
a.Settings().SetTheme(theme.LightTheme()) a.Settings().SetTheme(theme.LightTheme())
}
w := a.NewWindow("Gitmoji Picker") w := a.NewWindow("Gitmoji Picker")
w.CenterOnScreen() w.CenterOnScreen()