mirror of
https://github.com/issadarkthing/gomu.git
synced 2025-04-26 13:49:21 +08:00
use config color
This commit is contained in:
parent
05cb4f1534
commit
f3f317f2f3
2
gomu.go
2
gomu.go
@ -34,7 +34,7 @@ type Gomu struct {
|
||||
func newGomu() *Gomu {
|
||||
|
||||
gomu := &Gomu{
|
||||
popupBg: tcell.GetColor("#0A0F14"),
|
||||
popupBg: tcell.GetColor(viper.GetString("color.popup")),
|
||||
textColor: tcell.GetColor(viper.GetString("color.foreground")),
|
||||
accentColor: tcell.GetColor(viper.GetString("color.accent")),
|
||||
}
|
||||
|
3
popup.go
3
popup.go
@ -140,6 +140,9 @@ func timedPopup(
|
||||
SetText(desc).
|
||||
SetTextColor(gomu.accentColor)
|
||||
|
||||
// debugLog(fmt.Sprintf("from color: %d", tcell.GetColor("#FF0000")))
|
||||
// debugLog(fmt.Sprintf("from color: %d", tcell.GetColor("#0A0F14")))
|
||||
// debugLog(fmt.Sprintf("from config: %d", gomu.popupBg))
|
||||
textView.SetTextAlign(tview.AlignCenter).SetBackgroundColor(gomu.popupBg)
|
||||
|
||||
box := tview.NewFrame(textView).SetBorders(1, 0, 0, 0, 0, 0)
|
||||
|
18
start.go
18
start.go
@ -95,16 +95,18 @@ func readConfig(args Args) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
// Validate hex color
|
||||
for k, v := range colors {
|
||||
cfgColor := viper.GetString(k)
|
||||
if validateHexColor(cfgColor) {
|
||||
continue
|
||||
// Validate hex color
|
||||
for k, v := range colors {
|
||||
cfgColor := viper.GetString(k)
|
||||
if validateHexColor(cfgColor) {
|
||||
continue
|
||||
}
|
||||
// debugLog(fmt.Sprintf("%s is replaced by %s", cfgColor, v))
|
||||
// use default value if invalid hex color was given
|
||||
viper.Set(k, v)
|
||||
}
|
||||
// use default value if invalid hex color was given
|
||||
viper.Set(k, v)
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user