Skip to main content

Module progress

Module progress 

Source
Expand description

Cleanroom Rust port of upstream Go source file: progress/progress.go Upstream Target Tag / Version: v2.1.0

# Progress

A simple progress bar for Bubble Tea applications.

The spring-based animation is an inline port of github.com/charmbracelet/harmonica (a simplified damped harmonic oscillator), which the upstream progress component uses for animated transitions.

Structs§

FrameMsg
FrameMsg indicates that an animation step should occur.
Model
Model stores values we’ll use when rendering the progress bar.

Constants§

DEFAULT_EMPTY_CHAR_BLOCK
DefaultEmptyCharBlock is the default character used to fill the empty portion of the progress bar.
DEFAULT_FULL_CHAR_FULL_BLOCK
DefaultFullCharFullBlock can also be used as a fill character for the progress bar. Use this to disable the higher resolution blending which is enabled when using DEFAULT_FULL_CHAR_HALF_BLOCK.
DEFAULT_FULL_CHAR_HALF_BLOCK
DefaultFullCharHalfBlock is the default character used to fill the progress bar. It is a half block, which allows more granular color blending control, by having a different foreground and background color, doubling blending resolution.

Functions§

default_blend_end
defaultBlendEnd is the end of the default color blend (neon pink).
default_blend_start
defaultBlendStart is the start of the default color blend (purple haze).
default_empty_color
defaultEmptyColor is the default “empty” color (slate gray).
default_full_color
defaultFullColor is the default “filled” color (blueberry).
new
New returns a model with default values.
with_color_func
WithColorFunc sets a function that can be used to dynamically fill the progress bar based on the current percentage. total is the total filled percentage, and current is the current percentage that is actively being filled with a color. When specified, this overrides any other defined colors and scaling.
with_colors
WithColors sets the colors to use to fill the progress bar. Depending on the number of colors passed in, will determine whether to use a solid fill or a blend of colors.
with_default_blend
WithDefaultBlend sets a default blend of colors, which is a blend of purple haze to neon pink.
with_fill_characters
WithFillCharacters sets the characters used to construct the full and empty components of the progress bar.
with_scaled
WithScaled sets whether to scale the blend/gradient to fit the width of only the filled portion of the progress bar. The default is false, which means the percentage must be 100% to see the full color blend/gradient.
with_spring_options
WithSpringOptions sets the initial frequency and damping options for the progress bar’s built-in spring-based animation. Frequency corresponds to speed, and damping to bounciness.
with_width
WithWidth sets the initial width of the progress bar. Note that you can also set the width via the width property, which can come in handy if you’re waiting for a tea.WindowSizeMsg.
without_percentage
WithoutPercentage hides the numeric percentage.

Type Aliases§

ColorFunc
ColorFunc is a function that can be used to dynamically fill the progress bar based on the current percentage. total is the total filled percentage, and current is the current percentage that is actively being filled with a color.
Option
Option is used to set options in new. For example: