progressbar

package
v0.1.19 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*ProgressBar)

func WithEmptyColor

func WithEmptyColor(c color.Color) Option

func WithFillColor

func WithFillColor(c color.Color) Option

type ProgressBar

type ProgressBar struct {
	Width      int
	Percentage float64
	FillColor  color.Color
	EmptyColor color.Color
}

func New

func New(width int, percentage float64, opts ...Option) ProgressBar

func (ProgressBar) Render

func (p ProgressBar) Render() string

type SegmentedOption added in v0.1.3

type SegmentedOption func(*SegmentedProgressBar)

func WithSegmentWidth added in v0.1.3

func WithSegmentWidth(w int) SegmentedOption

func WithSegmentedColors added in v0.1.3

func WithSegmentedColors(poor, sufficient, optimal color.Color) SegmentedOption

func WithSegmentedThresholds added in v0.1.3

func WithSegmentedThresholds(sufficient, optimal float64) SegmentedOption

WithSegmentedThresholds sets custom thresholds for sufficient and optimal.

type SegmentedProgressBar added in v0.1.3

type SegmentedProgressBar struct {
	Width               int
	Percentage          float64
	PoorColor           color.Color // below SufficientThreshold
	SufficientColor     color.Color // SufficientThreshold to OptimalThreshold
	OptimalColor        color.Color // above OptimalThreshold
	DimColor            color.Color
	SegmentWidth        int
	SufficientThreshold float64 // threshold for sufficient (default 70)
	OptimalThreshold    float64 // threshold for optimal (default 85)
}

SegmentedProgressBar represents a 3-segment progress bar where only the active segment is highlighted based on the percentage range

func NewSegmented added in v0.1.3

func NewSegmented(percentage float64, opts ...SegmentedOption) SegmentedProgressBar

func (SegmentedProgressBar) Render added in v0.1.3

func (s SegmentedProgressBar) Render() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL