From 99bec9d9cd20adf0e446de8571a47ca70d4cba97 Mon Sep 17 00:00:00 2001 From: davidovski Date: Tue, 9 Nov 2021 17:43:58 +0000 Subject: changed colours a bit --- src/util.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/util.py') diff --git a/src/util.py b/src/util.py index de05b08..3badca0 100644 --- a/src/util.py +++ b/src/util.py @@ -4,8 +4,11 @@ import colors import time import os +DEFAULT_BAR_COLOR = colors.BLACK + colors.BG_CYAN +DEFAULT_BAR_COLOR_RESET = colors.BG_BLACK + colors.CYAN + def loading_bar(completed, total, text, - unit=""): + unit="", color=DEFAULT_BAR_COLOR, reset=DEFAULT_BAR_COLOR_RESET): columns, rows = shutil.get_terminal_size((80, 20)) @@ -14,11 +17,10 @@ def loading_bar(completed, total, text, spaces = columns - (len(count) + len(text)) info = text + "".join([" " for i in range(spaces)]) + count - reset_at = int((completed/total)*len(info)) if total > 0 else 0 - info = "".join([info[i] + (colors.RESET if i == reset_at else "") for i in range(len(info))]) + info = "".join([info[i] + (reset if i == reset_at else "") for i in range(len(info))]) - print(colors.BLACK + colors.BG_GREEN + info, end="\r") + print(color + info, end="\r") -- cgit v1.2.1