aboutsummaryrefslogtreecommitdiff
path: root/utils/balance.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/balance.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/balance.py')
-rw-r--r--utils/balance.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/utils/balance.py b/utils/balance.py
index 64fa3e3..c13dee8 100644
--- a/utils/balance.py
+++ b/utils/balance.py
@@ -2,6 +2,7 @@ from typing import List
from utils.read_file import entry
from utils.register import currencies, complete_prices
+from utils.colored_output import *
class tree:
@@ -53,18 +54,18 @@ class tree:
result = ''
if not ignore_level:
for price in self.value:
- result += f'{price:>20}\n'
+ result += price_f(f'{price:>20}') + '\n'
result = result.rstrip()
result += ' ' + ' '*(2 * level)
if len(self.children) == 1:
- result += self.name + ':'
+ result += account_f(self.name + ':')
for child in self.children:
result += child.__str__(level + 1, ignore_level = True)
else:
- result += self.name + '\n'
+ result += account_f(self.name) + '\n'
for child in self.children:
result += child.__str__(level + 1)
@@ -96,7 +97,7 @@ class accounts_tree:
result += '--------------------\n'
for price in self.my_accounts.value:
- result += f'{price:>20}\n'
+ result += price_f(f'{price:>20}') + '\n'
return result.rstrip()