💄 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

12
main.go
View File

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