💄 Allow setting the theme
This commit is contained in:
parent
79d322de14
commit
e3e64309b6
12
main.go
12
main.go
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in New Issue