Skip to content

Commit c10b76b

Browse files
committed
docs(readme): gradient percentage on the plain race lane, history wording
The full bar's default widgets color the percentage readout with the red to green progress gradient, so the plain progressbar2 lane in the benchmark race now wears that too instead of rendering colorless. The stability section states the support history the way it actually ran: non-stop since 2012, and since 2008 before that as the original progressbar library.
1 parent 76d061f commit c10b76b

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

‎README.md‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,10 +380,9 @@ if __name__ == '__main__':
380380
The features above are the flashy half. The other half is why the
381381
package has survived since 2012:
382382

383-
- Maintained since February 2012, with 111 releases on PyPI since
384-
2013. The lineage goes back further: this is the continuation of the
385-
original `progressbar` package, on PyPI since 2006, and it still
386-
works as a drop-in replacement for it.
383+
- Supported non-stop since 2012, with 111 releases on PyPI, and since
384+
2008 before that as the original `progressbar` library, which
385+
progressbar2 still replaces drop-in.
387386
- 1131 tests at 100% branch coverage, enforced in CI on every commit.
388387
- Fully typed (PEP 561 `py.typed`), so your type checker sees the real
389388
signatures.

‎docs/_static/demos/readme-race.svg‎

Lines changed: 1 addition & 1 deletion
Loading

‎scripts/render_race.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,13 @@ def race_frames(results: dict[str, typing.Any]) -> list[list[str]]:
141141
fraction = min(1.0, t / total)
142142
filled = round(fraction * BAR_WIDTH)
143143
pct = f'{fraction * 100:3.0f}%'
144+
if lane == 'progressbar2':
145+
# The full bar's default widgets color the percentage
146+
# readout with the red->green progress gradient
147+
# (widgets.Bar's `fg=colors.gradient` default), so the
148+
# plain lane wears that here too. The fill stays plain
149+
# '#', which is also faithful to the default look.
150+
pct = f'{_sgr(*_gradient_rgb(fraction))}{pct}{RESET}'
144151
suffix = f' {total * 1000:.1f} ms' if fraction >= 1.0 else ''
145152
lines.append(
146153
f'{RESET}{lane:<{LABEL_WIDTH}} {pct} '

0 commit comments

Comments
 (0)