ProgressBar Reference¶
See the ProgressBar guide for usage examples.
A progress bar whose completed portion is painted with a gradient.
The gradient spans the whole bar width, so colors stay fixed in place and are
revealed as the bar fills. The unfilled track keeps Rich's style.
Pulse mode is not gradient-aware and renders as Rich normally would.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
total
|
float | None
|
Number of steps, or |
100.0
|
completed
|
float
|
Number of completed steps. |
0
|
width
|
int | None
|
Fixed width in cells, or |
None
|
pulse
|
bool
|
Render Rich's pulse animation (no gradient). |
False
|
style
|
StyleType
|
Style of the unfilled track. |
'bar.back'
|
complete_style
|
StyleType
|
Style of the filled portion before the gradient. |
'bar.complete'
|
finished_style
|
StyleType
|
Style used once the bar is complete. |
'bar.finished'
|
pulse_style
|
StyleType
|
Style used in pulse mode. |
'bar.pulse'
|
colors
|
Sequence[ColorType] | None
|
Gradient color stops. |
None
|
rainbow
|
bool
|
Whether to generate a rainbow palette. |
False
|
hues
|
int
|
Number of auto-generated hues. |
5
|
Source code in src/rich_gradient/progress_bar.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | |
percentage_completed
property
¶
Return the completion percentage, or None if indeterminate.
__getattr__(name)
¶
Expose Rich's bar state (completed, total, styles, ...).
Source code in src/rich_gradient/progress_bar.py
__init__(total=100.0, completed=0, width=None, pulse=False, style='bar.back', complete_style='bar.complete', finished_style='bar.finished', pulse_style='bar.pulse', *, colors=None, rainbow=False, hues=5)
¶
Initialize the gradient progress bar.
Source code in src/rich_gradient/progress_bar.py
__rich_console__(console, options)
¶
Render the bar, adding gradient colors to the filled cells.
Filled cells are identified by position (mirroring Rich's own width math), not by color, so they are found even when the fill and track share a color. The gradient replaces only the foreground; Rich's fill style keeps its background and attributes.
Source code in src/rich_gradient/progress_bar.py
__rich_measure__(console, options)
¶
__setattr__(name, value)
¶
Route Rich's bar state attributes to the wrapped bar.