Skip to content

Commit a51a2f2

Browse files
committed
Improve banner printing
1 parent d238c06 commit a51a2f2

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

utils/console.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,32 @@ def get_formatted_time():
2424

2525
def print_banner():
2626
copyright_ = f"( Ghost v{config.VERSION} )"
27-
banner = f""" ██████╗ ██╗ ██╗ ██████╗ ███████╗████████╗
28-
██╔════╝ ██║ ██║██╔═══██╗██╔════╝╚══██╔══╝
29-
██║ ███╗███████║██║ ██║███████╗ ██║
30-
██║ ██║██╔══██║██║ ██║╚════██║ ██║
31-
╚██████╔╝██║ ██║╚██████╔╝███████║ ██║
32-
╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝ ╚═╝
27+
total_width = 90
28+
copyright_length = len(copyright_)
29+
dashes_length = (total_width - copyright_length) // 2
30+
dashes = "—" * dashes_length
31+
banner_line = f"{dashes}{copyright_}{dashes}"
32+
33+
if len(banner_line) < total_width:
34+
banner_line += "—"
35+
36+
banner = f""" ██████╗ ██╗ ██╗ ██████╗ ███████╗████████╗
37+
██╔════╝ ██║ ██║██╔═══██╗██╔════╝╚══██╔══╝
38+
██║ ███╗███████║██║ ██║███████╗ ██║
39+
██║ ██║██╔══██║██║ ██║╚════██║ ██║
40+
╚██████╔╝██║ ██║╚██████╔╝███████║ ██║
41+
╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝ ╚═╝
3342
3443
"""
3544
print(colorama.Fore.LIGHTBLUE_EX + colorama.Style.BRIGHT)
36-
37-
# banner = banner.replace("█", f"{colorama.Fore.LIGHTBLUE_EX}{colorama.Style.BRIGHT}█{colorama.Style.RESET_ALL}")
38-
# banner = banner.replace("╗", f"{colorama.Fore.WHITE}{colorama.Style.DIM}╗{colorama.Style.RESET_ALL}")
39-
# banner = banner.replace("║", f"{colorama.Fore.WHITE}{colorama.Style.DIM}║{colorama.Style.RESET_ALL}")
40-
# banner = banner.replace("═", f"{colorama.Fore.WHITE}{colorama.Style.DIM}═{colorama.Style.RESET_ALL}")
41-
# banner = banner.replace("╝", f"{colorama.Fore.WHITE}{colorama.Style.DIM}╝{colorama.Style.RESET_ALL}")
42-
# banner = banner.replace("╔", f"{colorama.Fore.WHITE}{colorama.Style.DIM}╔{colorama.Style.RESET_ALL}")
43-
# banner = banner.replace("╚", f"{colorama.Fore.WHITE}{colorama.Style.DIM}╚{colorama.Style.RESET_ALL}")
44-
4545
print(pystyle.Center.XCenter(banner))
46-
4746
print(f"{colorama.Style.NORMAL}{colorama.Fore.WHITE}")
4847
print(pystyle.Center.XCenter(config.MOTD))
4948
print()
50-
print(f"{colorama.Fore.BLUE}—————————————————————————————————————{copyright_}—————————————————————————————————————")
49+
print(f"{colorama.Fore.BLUE}{banner_line}")
5150
print(f"{colorama.Style.RESET_ALL}")
5251

52+
5353
def print_color(color, text):
5454
print(color + text + colorama.Style.RESET_ALL)
5555

@@ -80,5 +80,5 @@ def print_sniper(sniper, title, description: dict, success=True):
8080

8181
for key, value in description.items():
8282
print(f"{' '*10} {colorama.Fore.LIGHTYELLOW_EX}{colorama.Style.NORMAL}{key}: {colorama.Style.RESET_ALL}{value}")
83-
84-
print()
83+
84+
print()

0 commit comments

Comments
 (0)