styleText-vish 0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- styletext_vish-0.1/PKG-INFO +5 -0
- styletext_vish-0.1/pyproject.toml +3 -0
- styletext_vish-0.1/setup.cfg +4 -0
- styletext_vish-0.1/setup.py +8 -0
- styletext_vish-0.1/styleText.py +127 -0
- styletext_vish-0.1/styleText_vish.egg-info/PKG-INFO +5 -0
- styletext_vish-0.1/styleText_vish.egg-info/SOURCES.txt +8 -0
- styletext_vish-0.1/styleText_vish.egg-info/dependency_links.txt +1 -0
- styletext_vish-0.1/styleText_vish.egg-info/requires.txt +1 -0
- styletext_vish-0.1/styleText_vish.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import time
|
|
3
|
+
import string
|
|
4
|
+
import random
|
|
5
|
+
import pyjokes
|
|
6
|
+
import re
|
|
7
|
+
|
|
8
|
+
def typeText(text, delay=0.03):
|
|
9
|
+
"""Simulates realistic typing speed."""
|
|
10
|
+
for char in text:
|
|
11
|
+
sys.stdout.write(char)
|
|
12
|
+
sys.stdout.flush()
|
|
13
|
+
time.sleep(delay)
|
|
14
|
+
print()
|
|
15
|
+
|
|
16
|
+
def hacker_decode(text, speed=0.04):
|
|
17
|
+
"""Hacker/Cyberpunk decoding animation effect that safely handles ANSI color codes."""
|
|
18
|
+
chars = string.ascii_letters + string.digits + "!@#$%^&*"
|
|
19
|
+
|
|
20
|
+
# Strip ANSI escape codes to know the real visible length
|
|
21
|
+
ansi_escape = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])')
|
|
22
|
+
plain_text = ansi_escape.sub('', text)
|
|
23
|
+
|
|
24
|
+
revealed = ""
|
|
25
|
+
for target_char in plain_text:
|
|
26
|
+
# Cycle random characters before locking in the correct character
|
|
27
|
+
for _ in range(3):
|
|
28
|
+
sys.stdout.write('\r' + revealed + random.choice(chars))
|
|
29
|
+
sys.stdout.flush()
|
|
30
|
+
time.sleep(speed)
|
|
31
|
+
revealed += target_char
|
|
32
|
+
sys.stdout.write('\r' + revealed)
|
|
33
|
+
sys.stdout.flush()
|
|
34
|
+
|
|
35
|
+
# Reprint the full styled/colored text at the very end
|
|
36
|
+
sys.stdout.write('\r' + text)
|
|
37
|
+
sys.stdout.flush()
|
|
38
|
+
print()
|
|
39
|
+
|
|
40
|
+
def glitch_text(text, glitch_chance=0.2):
|
|
41
|
+
"""Replaces random characters with glitch symbols."""
|
|
42
|
+
glitch_chars = "░▒▓█<>/\\|#@$%"
|
|
43
|
+
result = []
|
|
44
|
+
for char in text:
|
|
45
|
+
if char != ' ' and random.random() < glitch_chance:
|
|
46
|
+
result.append(random.choice(glitch_chars))
|
|
47
|
+
else:
|
|
48
|
+
result.append(char)
|
|
49
|
+
return ''.join(result)
|
|
50
|
+
|
|
51
|
+
def rainbow_type(text, delay=0.03):
|
|
52
|
+
"""Types out text in dynamic rainbow colors and returns the formatted string."""
|
|
53
|
+
colors = [
|
|
54
|
+
"\033[91m", # Red
|
|
55
|
+
"\033[93m", # Yellow
|
|
56
|
+
"\033[92m", # Green
|
|
57
|
+
"\033[96m", # Cyan
|
|
58
|
+
"\033[94m", # Blue
|
|
59
|
+
"\033[95m" # Magenta
|
|
60
|
+
]
|
|
61
|
+
reset = "\033[0m"
|
|
62
|
+
formatted_chars = []
|
|
63
|
+
|
|
64
|
+
for i, char in enumerate(text):
|
|
65
|
+
color = colors[i % len(colors)]
|
|
66
|
+
styled_char = f"{color}{char}{reset}"
|
|
67
|
+
|
|
68
|
+
if delay > 0:
|
|
69
|
+
sys.stdout.write(styled_char)
|
|
70
|
+
sys.stdout.flush()
|
|
71
|
+
time.sleep(delay)
|
|
72
|
+
|
|
73
|
+
formatted_chars.append(styled_char)
|
|
74
|
+
|
|
75
|
+
if delay > 0:
|
|
76
|
+
print()
|
|
77
|
+
|
|
78
|
+
return "".join(formatted_chars)
|
|
79
|
+
|
|
80
|
+
def colorize(text, color_code, show_help=False):
|
|
81
|
+
"""Colorizes the text with the given ANSI color code."""
|
|
82
|
+
if show_help:
|
|
83
|
+
print("Usage: colorize(text, color_code)\n"
|
|
84
|
+
"Color codes: 91=Red, 92=Green, 93=Yellow, "
|
|
85
|
+
"94=Blue, 95=Magenta, 96=Cyan and more...\n"
|
|
86
|
+
"Example: colorize('Hello Bro', 91)")
|
|
87
|
+
return f"\033[{color_code}m{text}\033[0m"
|
|
88
|
+
|
|
89
|
+
def makeRandomString(length=10, type='alphanumeric'):
|
|
90
|
+
if type == 'alphanumeric':
|
|
91
|
+
return ''.join(random.choices(string.ascii_letters + string.digits, k=length))
|
|
92
|
+
elif type == 'alphanumsigns':
|
|
93
|
+
return ''.join(random.choices(string.ascii_letters + string.digits + string.punctuation, k=length))
|
|
94
|
+
elif type == 'letters':
|
|
95
|
+
return ''.join(random.choices(string.ascii_letters, k=length))
|
|
96
|
+
elif type == 'digits':
|
|
97
|
+
return ''.join(random.choices(string.digits, k=length))
|
|
98
|
+
elif type == 'hex':
|
|
99
|
+
return ''.join(random.choices(string.hexdigits, k=length))
|
|
100
|
+
else:
|
|
101
|
+
raise ValueError("Invalid type")
|
|
102
|
+
def makeJokes():
|
|
103
|
+
"""Fetches a random joke using the pyjokes library."""
|
|
104
|
+
return pyjokes.get_joke(category='all')
|
|
105
|
+
def hacker_spinner(duration=3.0, message="HACKING THE MAINFRME"):
|
|
106
|
+
"""Displays an animated spinner with a status message."""
|
|
107
|
+
spinner_chars = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]
|
|
108
|
+
end_time = time.time() + duration
|
|
109
|
+
i = 0
|
|
110
|
+
while time.time() < end_time:
|
|
111
|
+
sys.stdout.write(f"\r{colorize(spinner_chars[i % len(spinner_chars)], 96)} {message}...")
|
|
112
|
+
sys.stdout.flush()
|
|
113
|
+
time.sleep(0.1)
|
|
114
|
+
i += 1
|
|
115
|
+
sys.stdout.write(f"\r{colorize('✔', 92)} {message} - COMPLETE! \n")
|
|
116
|
+
sys.stdout.flush()
|
|
117
|
+
|
|
118
|
+
def loading_bar(total=100, prefix='PROGRESS', length=30, delay=0.03):
|
|
119
|
+
"""Displays a retro loading bar in the terminal."""
|
|
120
|
+
for i in range(total + 1):
|
|
121
|
+
percent = float(i) / total
|
|
122
|
+
filled = int(length * i // total)
|
|
123
|
+
bar = '█' * filled + '-' * (length - filled)
|
|
124
|
+
sys.stdout.write(f"\r{prefix} |{bar}| {int(percent * 100)}% ")
|
|
125
|
+
sys.stdout.flush()
|
|
126
|
+
time.sleep(delay)
|
|
127
|
+
print()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pyjokes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
styleText
|