Adds color support

Cleans up code a bit, removes spelling errors. Also updates variable names to better conform to Go standards.
This commit is contained in:
Brian Davidson 2016-12-21 18:15:51 -08:00
parent f63e0cdd3f
commit 93f8e2797b

163
table.go
View File

@ -2,9 +2,27 @@ package termui
import "strings" import "strings"
/* /* Table is like:
Awesome Table
Col0 | Col1 | Col2 | Col3 | Col4 | Col5 | Col6 |
Some Item #1 | AAA | 123 | CCCCC | EEEEE | GGGGG | IIIII |
Some Item #2 | BBB | 456 | DDDDD | FFFFF | HHHHH | JJJJJ |
Datapoints are a two dimensional array of strings: [][]string
Example:
data := [][]string{
{"Col0", "Col1", "Col3", "Col4", "Col5", "Col6"},
{"Some Item #1", "AAA", "123", "CCCCC", "EEEEE", "GGGGG", "IIIII"},
{"Some Item #2", "BBB", "456", "DDDDD", "FFFFF", "HHHHH", "JJJJJ"},
}
table := termui.NewTable() table := termui.NewTable()
table.Rows = rows table.Rows = data // type [][]string
table.FgColor = termui.ColorWhite table.FgColor = termui.ColorWhite
table.BgColor = termui.ColorDefault table.BgColor = termui.ColorDefault
table.Height = 7 table.Height = 7