2
0
mirror of https://github.com/hibiken/asynq.git synced 2025-10-03 05:12:01 +08:00

(cli): Define styles in global scope

This commit is contained in:
Ken Hibino
2022-05-27 15:01:34 -07:00
parent 2f95ff0442
commit 193881ffb0
2 changed files with 5 additions and 3 deletions

View File

@@ -64,8 +64,6 @@ type Options struct {
PollInterval time.Duration PollInterval time.Duration
} }
var baseStyle = tcell.StyleDefault.Background(tcell.ColorReset).Foreground(tcell.ColorReset)
func Run(opts Options) { func Run(opts Options) {
s, err := tcell.NewScreen() s, err := tcell.NewScreen()
if err != nil { if err != nil {

View File

@@ -18,6 +18,11 @@ import (
"github.com/mattn/go-runewidth" "github.com/mattn/go-runewidth"
) )
var (
baseStyle = tcell.StyleDefault.Background(tcell.ColorReset).Foreground(tcell.ColorReset)
labelStyle = baseStyle.Foreground(tcell.ColorLightGray)
)
// drawer draws UI with the given state. // drawer draws UI with the given state.
type drawer interface { type drawer interface {
Draw(state *State) Draw(state *State)
@@ -259,7 +264,6 @@ func drawQueueSummary(d *ScreenDrawer, state *State) {
d.Println("ERROR: Press q to go back", baseStyle) d.Println("ERROR: Press q to go back", baseStyle)
return return
} }
labelStyle := baseStyle.Foreground(tcell.ColorLightGray)
d.Print("Name: ", labelStyle) d.Print("Name: ", labelStyle)
d.Println(q.Queue, baseStyle) d.Println(q.Queue, baseStyle)
d.Print("Size: ", labelStyle) d.Print("Size: ", labelStyle)