fixed the print colors

This commit is contained in:
root 2025-01-24 18:27:32 +01:00
parent 0e0f1359b9
commit e3a10675ef
5 changed files with 56 additions and 45 deletions

View file

@ -1,7 +1,11 @@
import re
import os, pwd, re, pandas as pd, requests, shutil
from PIL import Image
import urllib
import socks, socket, glob
PURPLE = '\033[35;40m'
BOLD_PURPLE = '\033[35;40;1m'
ORANGE = '\033[33;40;1m'
RED = '\033[31;40m'
BOLD_RED = '\033[31;40;1m'
RESET = '\033[m'
@ -242,18 +246,25 @@ def IsNameValid(name: str)->bool:
def print_colors(s:str, bold=False, is_error = False, default=False):
"""
Helper function to print with colors
"""
#def print_colors(s:str, bold=False, is_error = False, default=False):
def print_colors(*args, bold=False, is_error=False, default=False, highlight=False):
"""
Helper function to print with colors
"""
for s in args:
if is_error:
print(f"{RED}{s}{RESET}")
print(f"{RED}{s}{RESET}",end='')
elif highlight:
print(f"{ORANGE}{s}{RESET}",end='')
elif bold:
print(f"{BOLD_PURPLE}{s}{RESET}")
print(f"{BOLD_PURPLE}{s}{RESET}",end='')
elif is_error and bold:
print(f"{BOLD_RED}{s}{RESET}")
print(f"{BOLD_RED}{s}{RESET}",end='')
elif default:
print(f'{s}')
print(f'{s}',end='')
else:
print(f"{PURPLE}{s}{RESET}")
print(f"{PURPLE}{s}{RESET}",end='')
if s is args[-1]:
print()