mirror of https://github.com/gdamore/tcell.git
Add a sample style to hello world.
This commit is contained in:
parent
0c349a85f4
commit
299cb413dc
|
@ -43,7 +43,8 @@ func emitStr(s tcell.Screen, x, y int, style tcell.Style, str string) {
|
||||||
func displayHelloWorld(s tcell.Screen) {
|
func displayHelloWorld(s tcell.Screen) {
|
||||||
w, h := s.Size()
|
w, h := s.Size()
|
||||||
s.Clear()
|
s.Clear()
|
||||||
emitStr(s, w/2-7, h/2, tcell.StyleDefault, "Hello, World!")
|
style := tcell.StyleDefault.Foreground(tcell.ColorCadetBlue.TrueColor()).Background(tcell.ColorWhite)
|
||||||
|
emitStr(s, w/2-7, h/2, style, "Hello, World!")
|
||||||
emitStr(s, w/2-9, h/2+1, tcell.StyleDefault, "Press ESC to exit.")
|
emitStr(s, w/2-9, h/2+1, tcell.StyleDefault, "Press ESC to exit.")
|
||||||
s.Show()
|
s.Show()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue