list.go 895 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright 2017 Zack Guo <zack.y.guo@gmail.com>. All rights reserved.
  2. // Use of this source code is governed by a MIT license that can
  3. // be found in the LICENSE file.
  4. // +build ignore
  5. package main
  6. import "notabug.org/themusicgod1/termui"
  7. func main() {
  8. err := termui.Init()
  9. if err != nil {
  10. panic(err)
  11. }
  12. defer termui.Close()
  13. //termui.UseTheme("helloworld")
  14. strs := []string{
  15. "[0] notabug.org/themusicgod1/termui",
  16. "[1] [你好,世界](fg-blue)",
  17. "[2] [こんにちは世界](fg-red)",
  18. "[3] [color output](fg-white,bg-green)",
  19. "[4] output.go",
  20. "[5] random_out.go",
  21. "[6] dashboard.go",
  22. "[7] nsf/termbox-go"}
  23. ls := termui.NewList()
  24. ls.Items = strs
  25. ls.ItemFgColor = termui.ColorYellow
  26. ls.BorderLabel = "List"
  27. ls.Height = 7
  28. ls.Width = 25
  29. ls.Y = 0
  30. termui.Render(ls)
  31. termui.Handle("/sys/kbd/q", func(termui.Event) {
  32. termui.StopLoop()
  33. })
  34. termui.Loop()
  35. }