2023-10-13 22:58:42 +08:00
|
|
|
# -------------------------------
|
|
|
|
# Difficult Rocket
|
|
|
|
# Copyright © 2020-2023 by shenjackyuanjie 3695888@qq.com
|
|
|
|
# All rights reserved
|
|
|
|
# -------------------------------
|
2023-10-14 20:02:42 +08:00
|
|
|
import sys
|
2023-10-13 22:58:42 +08:00
|
|
|
|
2023-10-14 20:02:42 +08:00
|
|
|
COLOR_SUPPORT = True
|
2023-10-13 22:58:42 +08:00
|
|
|
|
2023-10-14 20:02:42 +08:00
|
|
|
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
|