-
Notifications
You must be signed in to change notification settings - Fork 4
/
10-tablewriter-colors.go
38 lines (32 loc) · 1.09 KB
/
10-tablewriter-colors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Seriál "Programovací jazyk Go"
// https://www.root.cz/serialy/programovaci-jazyk-go/
//
// Sedmdesátá první část
// Formátovaný tisk obsahu tabulek a dalších datových struktur v Go
// https://www.root.cz/clanky/formatovany-tisk-obsahu-tabulek-a-dalsich-datovych-struktur-v-go/
//
// Repositář:
// https://github.com/tisnik/go-root/
//
// Seznam příkladů ze sedmdesáté první části:
// https://github.com/tisnik/go-root/blob/master/article_71/README.md
package main
import (
"log"
"os"
"github.com/olekukonko/tablewriter"
)
func main() {
table, err := tablewriter.NewCSV(os.Stdout, "tiobe.csv", true)
if err != nil {
log.Fatal(err)
}
table.SetBorder(false)
table.SetHeaderColor(
tablewriter.Colors{tablewriter.Bold, tablewriter.BgGreenColor},
tablewriter.Colors{tablewriter.FgHiRedColor, tablewriter.Bold, tablewriter.BgBlackColor},
tablewriter.Colors{tablewriter.BgRedColor, tablewriter.FgWhiteColor},
tablewriter.Colors{tablewriter.BgCyanColor, tablewriter.FgWhiteColor},
tablewriter.Colors{tablewriter.Bold, tablewriter.BgWhiteColor})
table.Render()
}