-
Notifications
You must be signed in to change notification settings - Fork 7
/
ConsoleColor.py
61 lines (54 loc) · 1.31 KB
/
ConsoleColor.py
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
import os, sys
import sys
import subprocess
import pkg_resources
required = {'rich'}
installed = {pkg.key for pkg in pkg_resources.working_set}
missing = required - installed
if missing:
python = sys.executable
subprocess.check_call([python, '-m', 'pip', 'install', *missing], stdout=subprocess.DEVNULL)
from rich.console import Console
from rich.theme import Theme
#console=Console(style="reset")
custom_theme = Theme({
"repr.path": "bright_blue",
"progress.percentage": "bright_blue",
"markdown.block_quote": "bright_blue",
"iso8601.time": "bright_blue"
})
console = Console(theme=custom_theme)
print=console.log
ccolor="bright_yellow"
"""
print("test", style="bold white on blue")
print("test", style="bold green")
print("test", style="bold CYAN")
"""
"""
import os
if __name__ == os.path.splitext(os.path.basename(__file__))[0] or __name__ =='__main__':
from ConsoleColor import print, console
else:
from .ConsoleColor import print, console
print(__file__)
print(os.path.basename(__file__))
"""
"""
print(
{
'test1':'tset',
'test2':'tset',
}
)
print("test", style="bold white on blue")
"""
"""
print(__file__)
print(os.path.basename(__file__))
try:
Exception_test()
except Exception:
#console.print_exception(show_locals=True)
console.print_exception()
"""