20 lines
595 B
Python
20 lines
595 B
Python
|
# -------------------------------
|
||
|
# Difficult Rocket
|
||
|
# Copyright © 2020-2023 by shenjackyuanjie 3695888@qq.com
|
||
|
# All rights reserved
|
||
|
# -------------------------------
|
||
|
import sys
|
||
|
|
||
|
COLOR_SUPPORT = True
|
||
|
|
||
|
if sys.platform == "win32":
|
||
|
try:
|
||
|
# https://stackoverflow.com/questions/36760127/...
|
||
|
# how-to-use-the-new-support-for-ansi-escape-sequences-in-the-windows-10-console
|
||
|
from ctypes import windll
|
||
|
|
||
|
kernel32 = windll.kernel32
|
||
|
kernel32.SetConsoleMode(kernel32.GetStdHandle(-11), 7)
|
||
|
except OSError: # pragma: no cover
|
||
|
COLOR_SUPPORT = False
|