-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcolorify.py
More file actions
116 lines (92 loc) · 2.19 KB
/
Copy pathcolorify.py
File metadata and controls
116 lines (92 loc) · 2.19 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
from sys import stdout, stdin
from time import sleep
class bg:
black = "\u001b[40m"
red = "\u001b[41m"
green = "\u001b[42m"
yellow = "\u001b[43m"
blue = "\u001b[44m"
magenta = "\u001b[45m"
cyan = "\u001b[46m"
white = "\u001b[47m"
def rgb(r, g, b):
return f"\u001b[48;2;{r};{g};{b}m"
class fg:
black = "\u001b[30m"
red = "\u001b[31m"
green = "\u001b[32m"
yellow = "\u001b[33m"
blue = "\u001b[34m"
magenta = "\u001b[35m"
cyan = "\u001b[36m"
white = "\u001b[37m"
def rgb(r, g, b):
return f"\u001b[38;2;{r};{g};{b}m"
class pencil:
reset = "\u001b[0m"
bold = "\u001b[1m"
underline = "\u001b[4m"
reverse = "\u001b[7m"
clear = "\u001b[2J"
clearline = "\u001b[2K"
up = "\u001b[1A"
down = "\u001b[1B"
right = "\u001b[1C"
left = "\u001b[1D"
nextline = "\u001b[1E"
prevline = "\u001b[1F"
top = "\u001b[0;0H"
def cls():
pencil.write(fg.white + bg.black + pencil.clear + pencil.top)
def to(x, y):
return f"\u001b[{y};{x}H"
def write(text="\n"):
stdout.write(text)
stdout.flush()
def writew(text="\n", wait=0.05):
for char in text:
stdout.write(char)
stdout.flush()
sleep(wait)
def writewb(*stuff, wait=0.5):
for s in stuff:
pencil.writew(s)
sleep(wait)
def read(begin=""):
text = ""
stdout.write(begin)
stdout.flush()
while True:
char = ord(stdin.read(1))
if char == 3:
return
elif char in (10, 13):
return text
else:
text += chr(char)
def readw(begin="", wait=0.05):
text = ""
for char in begin:
stdout.write(char)
stdout.flush()
sleep(wait)
while True:
char = ord(stdin.read(1))
if char == 3:
return
elif char in (10, 13):
return text
else:
text += chr(char)
# MAN IN THE MIRROR
# constants for colors
class mitm:
reset = bg.black + fg.white
process = fg.black + bg.cyan
option = fg.black + bg.green
userChoice = fg.black + bg.yellow
cutscene = fg.black + bg.magenta
item = fg.black + bg.rgb(254, 80, 0)
question = fg.white + bg.rgb(128, 0, 128)
title = fg.black + bg.red
error = fg.red + bg.black