aboutsummaryrefslogtreecommitdiff
path: root/utils/colored_output.py
diff options
context:
space:
mode:
authorAdrián Oliva <adrian.oliva@cimat.mx>2023-05-07 17:56:57 -0600
committerAdrián Oliva <adrian.oliva@cimat.mx>2023-05-07 17:56:57 -0600
commit4abdee1dc1891ad212a48040d89ebc5b9dcc6088 (patch)
treecc5d86b432eee4777c52931a089f710d7e779259 /utils/colored_output.py
parent3809d99e78466142c4dd8247e40f0826f436e8b6 (diff)
downloadLedger.py-4abdee1dc1891ad212a48040d89ebc5b9dcc6088.tar.gz
Ledger.py-4abdee1dc1891ad212a48040d89ebc5b9dcc6088.zip
Balance now has colors!
Moved color functions to its own file. Now the colored output can be easily edited in general.
Diffstat (limited to 'utils/colored_output.py')
-rw-r--r--utils/colored_output.py21
1 files changed, 21 insertions, 0 deletions
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