-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathcolor.py
More file actions
84 lines (62 loc) · 1.82 KB
/
color.py
File metadata and controls
84 lines (62 loc) · 1.82 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
import random
class color:
_on_template = '\x03{0:02d}{1}\x0F'
_off_template = '{1}'
_template = _on_template
@classmethod
def enable_colors(cls):
cls._template = cls._on_template
@classmethod
def disable_colors(cls):
cls._template = cls._off_template
@classmethod
def random(cls, text):
return cls._template.format(random.randint(0, 15), text)
@classmethod
def white(cls, text):
return cls._template.format(0, text)
@classmethod
def black(cls, text):
return cls._template.format(1, text)
@classmethod
def blue(cls, text):
return cls._template.format(2, text)
@classmethod
def green(cls, text):
return cls._template.format(3, text)
@classmethod
def light_red(cls, text):
return cls._template.format(4, text)
@classmethod
def red(cls, text):
return cls._template.format(5, text)
@classmethod
def purple(cls, text):
return cls._template.format(6, text)
@classmethod
def orange(cls, text):
return cls._template.format(7, text)
@classmethod
def yellow(cls, text):
return cls._template.format(8, text)
@classmethod
def light_green(cls, text):
return cls._template.format(9, text)
@classmethod
def cyan(cls, text):
return cls._template.format(10, text)
@classmethod
def light_cyan(cls, text):
return cls._template.format(11, text)
@classmethod
def light_blue(cls, text):
return cls._template.format(12, text)
@classmethod
def pink(cls, text):
return cls._template.format(13, text)
@classmethod
def gray(cls, text):
return cls._template.format(14, text)
@classmethod
def light_grey(cls, text):
return cls._template.format(15, text)