feat: added colors

This commit is contained in:
Hazel 2024-01-16 09:53:51 +01:00
parent 6a8374d595
commit fd0d22b751
2 changed files with 16 additions and 1 deletions

View File

@ -11,6 +11,7 @@ from ..utils.string_processing import fit_to_file_system
from ..utils.support_classes.query import Query from ..utils.support_classes.query import Query
from ..utils.support_classes.download_result import DownloadResult from ..utils.support_classes.download_result import DownloadResult
from ..utils.exception.download import UrlNotFoundException from ..utils.exception.download import UrlNotFoundException
from ..utils.enums.colors import BColors
from ..download.results import Results, Option, PageResults from ..download.results import Results, Option, PageResults
from ..download.page_attributes import Pages from ..download.page_attributes import Pages
from ..pages import Page from ..pages import Page
@ -176,7 +177,7 @@ class Downloader:
else: else:
prefix = ALPHABET[page_count % len(ALPHABET)] prefix = ALPHABET[page_count % len(ALPHABET)]
print( print(
f"({prefix}) ------------------------{option.__name__:{PAGE_NAME_FILL}<{MAX_PAGE_LEN}}------------") f"{BColors.HEADER}({prefix}) ------------------------{option.__name__:{PAGE_NAME_FILL}<{MAX_PAGE_LEN}}------------{BColors.ENDC}")
self.page_dict[prefix] = option self.page_dict[prefix] = option
self.page_dict[option.__name__] = option self.page_dict[option.__name__] = option

View File

@ -0,0 +1,14 @@
from enum import Enum
class BColors:
# https://stackoverflow.com/a/287944
HEADER = "\033[95m"
OKBLUE = "\033[94m"
OKCYAN = "\033[96m"
OKGREEN = "\033[92m"
WARNING = "\033[93m"
FAIL = "\033[91m"
ENDC = "\033[0m"
BOLD = "\033[1m"
UNDERLINE = "\033[4m"