From 4abdee1dc1891ad212a48040d89ebc5b9dcc6088 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Oliva?= Date: Sun, 7 May 2023 17:56:57 -0600 Subject: Balance now has colors! Moved color functions to its own file. Now the colored output can be easily edited in general. --- utils/colored_output.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 utils/colored_output.py (limited to 'utils/colored_output.py') diff --git a/utils/colored_output.py b/utils/colored_output.py new file mode 100644 index 0000000..e44c39d --- /dev/null +++ b/utils/colored_output.py @@ -0,0 +1,21 @@ +import colorama + + +def date_f(text: str) -> str: + """Format of the date.""" + return text + +def comment_f(text: str) -> str: + """Format of the transaction's comment.""" + return colorama.Style.BRIGHT + text + colorama.Style.RESET_ALL + +def account_f(text: str) -> str: + """Format of the account's name.""" + return colorama.Fore.BLUE + text + colorama.Style.RESET_ALL + +def price_f(text: str) -> str: + """Format of the price.""" + if '-' in text: + return colorama.Fore.RED + text + colorama.Style.RESET_ALL + else: + return text -- cgit v1.2.3