Skip to content

Instantly share code, notes, and snippets.

@lafftar
Last active March 20, 2022 04:09
Show Gist options
  • Save lafftar/2b8fa81816c1a87e6ebbcf2de05d7baa to your computer and use it in GitHub Desktop.
Save lafftar/2b8fa81816c1a87e6ebbcf2de05d7baa to your computer and use it in GitHub Desktop.
def wrap_back(text: [str, int, float, Any], color: str = Back.GREEN) -> str:
    """

    :param text: stuff that can be transformed to string
    :param color: really a AnsiCodes/AnsiBack
    :return: your wrapped string
    """
    return f'{color}{text}{Style.RESET_ALL}'
    
log = Log('TEST', do_update_title=False)
print(f'Python beats me {wrap_back("black", Back.BLACK)} and {wrap_back("blue", Back.BLUE)}. '
      f'JS causes {wrap_back(Fore.BLACK + Style.BRIGHT + "INSANITY", color=Back.LIGHTRED_EX)}.')
log.info(f"Hello {wrap_back('Mate', color=Back.BLACK)} !!! {Fore.GREEN + Style.BRIGHT + 'Oof, we back!' + Style.RESET_ALL}")

img

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment