sjmikler / progress-table

Display progress as a pretty table in the command line.
MIT License
90 stars 3 forks source link

[FEATURE] Support for colors on the row level #6

Closed naddeoa closed 6 months ago

naddeoa commented 9 months ago

Thanks for the library, been using it in a personal project and its been nice, just opening up a few issues that I'll hopefully be able to pitch in on.

I have a use case for setting color on the row level, somewhat dynamically. Each of my rows can either pass or fail (sort of like a test) and it would be nice to highlight them when they do fail.

sjmikler commented 9 months ago

Hey, thanks for all the feature requests, I appreciate it. They all are good ideas. Just wanted to let you know that I won't be able to work on any of them until the end of the year. But if you want to create a PR I can promptly review it and merge.

sjmikler commented 6 months ago

This feature was added in 1.0.0 version. Below you will find a little presentation of the feature:

from progress_table import ProgressTable
table = ProgressTable(default_row_color="black")

for i in range(10):
  table["aaa"] = 1
  table["bbb"] = 2

  if i % 3 == 0:
    table.next_row(color="bold red")
  if i % 3 == 1:
    table.next_row(color={"aaa": "yellow"})
  if i % 3 == 2:
    table.next_row()
table.close()

Which should produce this table obraz