1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] How do I make my big text 2 separate colors? (python) [closed]

Discussão em 'Python' iniciado por Stack, Setembro 14, 2024.

  1. Stack

    Stack Membro Participativo

    I'm trying to make my self a python multi-tool that'll save me time, I'm getting down the basics of everything but I'm confused on where to start with my banner, I want the outside @'s to be white (white) while the inside ones are the sky blue color (main), I tried doing it manually but just made it harder on myself and I gave up, it there a better/faster way to do this?

    You guys can take a look at my code here;

    import datetime

    white = "\033[97m"
    red = "\033[91m"
    main = "\033[38;2;135;206;250m"
    yellow = "\033[93m"
    reset = "\033[0m"

    banner = f'''
    @@@@@ @@@@@@@@ @@@@@ @@@@@ @@@@@@@@ @@@@@ @@@@@ @@@@@@@@@ @@@@@@
    @@@@@@@ @@@@@@@@@ @@@@@@@@@@@@ @@@@@@@@ @@@@@ @@@@@ @@@@@@@@@ @@@@@@@@@
    @@@@@@@@@@@@@@@ @@@@@@@@@ @@@@ @@@@@ @@@@@ @@@@@ @@@@@@@@@
    @@@@@@@@@@@@@@@ @@@@@@@ @@@@ @@@@@@@@@@@@ @@@@@ @@@@
    @@@@@ @@@ @@@@@ @@@@@@@@@@@ @@@@ @@@@@@@@@@@@ @@@@@ @@@@
    @@@@@ @@@@@ @@@@@@ @@@@@@ @@@@ @@@@@@@@@@@@ @@@@@ @@@@@ @@
    @@@@@ @@@@@ @@@@@ @@@@@ @@@@ @@@@@ @@@@@ @@@@@@@@@ @@@@@@@@@@
    @@@@@ @@@@@ @@@@ @@@@@ @@@@ @@@@@ @@@@@ @@@@@@@@@ @@@@@@@@
    '''

    class CustomLogger:

    def warning(self, message):
    timestamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
    print(f"[{white}{timestamp}] {yellow}@mxthic.warning:{reset}{white} {message}{reset}")

    def app(self, message):
    timestamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
    print(f"[{white}{timestamp}] {main}@mxthic.app:{reset}{white} {message}{reset}")

    def error(self, message):
    timestamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
    print(f"[{white}{timestamp}] {red}@mxthic.error:{reset}{white} {message}{reset}")

    def exit(self):
    timestamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
    print(f"{white}Press any key to exit . . .{reset}")

    logger = CustomLogger()

    Continue reading...

Compartilhe esta Página