Codebase list golang-github-vbauerster-mpb / c0a9854
red tip for spinTipBar example Vladimir Bauer 2 years ago
1 changed file(s) with 4 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
00 package main
11
22 import (
3 "fmt"
34 "math/rand"
45 "time"
56
1415 total := 100
1516 name := "Single Bar:"
1617 bar := p.New(int64(total),
17 mpb.BarStyle().Tip(`-`, `\`, `|`, `/`),
18 mpb.BarStyle().Tip(`-`, `\`, `|`, `/`).TipMeta(func(s string) string {
19 return fmt.Sprint("\033[31m", s, "\033[0m") // red
20 }),
1821 mpb.PrependDecorators(decor.Name(name)),
1922 mpb.AppendDecorators(decor.Percentage()),
2023 )