-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwelcome.py
More file actions
30 lines (25 loc) · 776 Bytes
/
welcome.py
File metadata and controls
30 lines (25 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import random
import os
def rainbow_text(text):
colors = [
'\033[91m', # Red
'\033[93m', # Yellow
'\033[92m', # Green
'\033[96m', # Cyan
'\033[94m', # Blue
'\033[95m', # Magenta
]
reset = '\033[0m'
result = ""
for i, c in enumerate(text):
result += colors[i % len(colors)] + c
return result + reset
def main():
script_dir = os.path.dirname(os.path.abspath(__file__))
messages_path = os.path.join(script_dir, "messages.txt")
with open(messages_path, "r", encoding="utf-8") as f:
messages = [line.strip() for line in f if line.strip()]
msg = random.choice(messages)
print(rainbow_text(msg))
if __name__ == "__main__":
main()