Skip to content

Conversation

@polymorcodeus
Copy link

Added OptionSetSpinnerColorCode to pass in color code for spinner - is ignored if not set or if color codes is not enabled. It's not terribly visible but more of a completeness feature.

Example Usage:

	bar := progressbar.NewOptions64(
		-1,
		progressbar.OptionSetDescription("[Counter Example] Received"),
		progressbar.OptionSetWidth(10),
		progressbar.OptionEnableColorCodes(true),
		progressbar.OptionSetSpinnerColorCode("red"),
		progressbar.OptionThrottle(65*time.Millisecond),
		progressbar.OptionShowCount(),
		progressbar.OptionSpinnerType(14),
		progressbar.OptionFullWidth(),
		progressbar.OptionSetRenderBlankState(true),
	)

	c := make(chan int)

	go func(notify chan<- int) {
		defer close(notify)
		for i := 0; i < 100; i++ {
			c <- i
			time.Sleep(time.Millisecond * 100)
		}
	}(c)

	for v := range c {
		bar.Add(v)
	}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant