colored_output.py (560B) - raw


      1 import colorama
      2 
      3 
      4 def date_f(text: str) -> str:
      5     """Format of the date."""
      6     return text
      7 
      8 def comment_f(text: str) -> str:
      9     """Format of the transaction's comment."""
     10     return colorama.Style.BRIGHT + text + colorama.Style.RESET_ALL
     11 
     12 def account_f(text: str) -> str:
     13     """Format of the account's name."""
     14     return colorama.Fore.BLUE + text + colorama.Style.RESET_ALL
     15 
     16 def price_f(text: str) -> str:
     17     """Format of the price."""
     18     if '-' in text:
     19         return colorama.Fore.RED + text + colorama.Style.RESET_ALL
     20     else:
     21         return text