Skip to content

Commit

Permalink
color the overhead between red and green (#252)
Browse files Browse the repository at this point in the history
color the overhead between red and green
  • Loading branch information
basnijholt authored and jbweston committed Dec 18, 2019
1 parent bbec975 commit 0015410
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion adaptive/notebook_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,14 @@ def _info_html(runner):
"finished": "green",
}[status]

overhead = runner.overhead()
red_level = max(0, min(int(255 * overhead / 100), 255))
overhead_color = "#{:02x}{:02x}{:02x}".format(red_level, 255 - red_level, 0)

info = [
("status", f'<font color="{color}">{status}</font>'),
("elapsed time", datetime.timedelta(seconds=runner.elapsed_time())),
("overhead", f"{runner.overhead():.2f}%"),
("overhead", f'<font color="{overhead_color}">{overhead:.2f}%</font>'),
]

with suppress(Exception):
Expand Down

0 comments on commit 0015410

Please sign in to comment.