package main import ( "fmt" "log" "os" "time" "github.com/gdamore/tcell/v2" ) func main() { fmt.Println() screen, err := tcell.NewScreen() if err != nil { log.Fatalf("%v", err) } if err := screen.Init(); err != nil { log.Fatalf("%v", err) } //defStyle := tcell.StyleDefault.Background defStyle := tcell.StyleDefault.Background(tcell.ColorReset).Foreground(tcell.ColorReset) screen.SetStyle(defStyle) go Run(screen, defStyle) for { switch event := screen.PollEvent().(type) { case *tcell.EventResize: screen.Sync() case *tcell.EventKey: switch event.Key() == tcell.KeyEscape || event.Key() == tcell.KeyCtrlC { case true: screen.Fini() os.Exit(0) } } } } func Run(screen tcell.Screen, defStyle tcell.Style) { for { screen.SetContent(20, 20, 'A', nil, defStyle) screen.Show() time.Sleep(time.Second) } }