optional seperators and specific color for row
This commit is contained in:
+20
-2
@@ -1,6 +1,6 @@
|
||||
package main
|
||||
|
||||
import "github.com/gizak/termui"
|
||||
import "termui"
|
||||
|
||||
func main() {
|
||||
err := termui.Init()
|
||||
@@ -8,6 +8,22 @@ func main() {
|
||||
panic(err)
|
||||
}
|
||||
defer termui.Close()
|
||||
rows_1 := [][]string{
|
||||
[]string{"header1", "header2", "header3"},
|
||||
[]string{"I love Veronica", "Go-lang is so cool", "Im working on Ruby"},
|
||||
[]string{"2016", "11", "11"},
|
||||
}
|
||||
|
||||
table_1 := termui.NewTable()
|
||||
table_1.Rows = rows_1
|
||||
table_1.FgColor = termui.ColorWhite
|
||||
table_1.BgColor = termui.ColorDefault
|
||||
table_1.Y = 0
|
||||
table_1.X = 0
|
||||
table_1.Width = 62
|
||||
table_1.Height = 7
|
||||
|
||||
termui.Render(table_1)
|
||||
|
||||
rows := [][]string{
|
||||
[]string{"header1", "header2", "header3"},
|
||||
@@ -20,9 +36,11 @@ func main() {
|
||||
table.FgColor = termui.ColorWhite
|
||||
table.BgColor = termui.ColorDefault
|
||||
table.TextAlign = "center"
|
||||
table.Seperator = false
|
||||
table.Analysis()
|
||||
table.SetSize()
|
||||
table.Y = 0
|
||||
table.BgColors[2] = termui.ColorRed
|
||||
table.Y = 20
|
||||
table.X = 0
|
||||
table.Border = true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user