代码拉取完成,页面将自动刷新
同步操作将从 小胖子/SafeTool-51testing 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import ctypes,sys
STD_INPUT_HANDLE = -10
STD_OUTPUT_HANDLE = -11
STD_ERROR_HANDLE = -12
'''
颜色属性由两个十六进制数字指定 -- 第一个为背景,第二个则为
前景。每个数字可以为以下任何值之一:
0 = 黑色 8 = 灰色
1 = 蓝色 9 = 淡蓝色
2 = 绿色 A = 淡绿色
3 = 浅绿色 B = 淡浅绿色
4 = 红色 C = 淡红色
5 = 紫色 D = 淡紫色
6 = 黄色 E = 淡黄色
7 = 白色 F = 亮白色
'''
# Windows CMD命令行 字体颜色定义 color help
FOREGROUND_BLACK = 0x00 # black.
FOREGROUND_DARKBLUE = 0x01 # dark blue.
FOREGROUND_DARKGREEN = 0x02 # dark green.
FOREGROUND_DARKSKYBLUE = 0x03 # dark skyblue.
FOREGROUND_DARKRED = 0x04 # dark red.
FOREGROUND_DARKPINK = 0x05 # dark pink.
FOREGROUND_DARKYELLOW = 0x06 # dark yellow.
FOREGROUND_DARKWHITE = 0x07 # dark white.
FOREGROUND_DARKGRAY = 0x08 # dark gray.
FOREGROUND_BLUE = 0x09 # blue.
FOREGROUND_GREEN = 0x0a # green.
FOREGROUND_SKYBLUE = 0x0b # skyblue.
FOREGROUND_RED = 0x0c # red.
FOREGROUND_PINK = 0x0d # pink.
FOREGROUND_YELLOW = 0x0e # yellow.
FOREGROUND_WHITE = 0x0f # white.
# Windows CMD命令行 背景颜色定义 background colors
BACKGROUND_BLUE = 0x10 # dark blue.
BACKGROUND_GREEN = 0x20 # dark green.
BACKGROUND_DARKSKYBLUE = 0x30 # dark skyblue.
BACKGROUND_DARKRED = 0x40 # dark red.
BACKGROUND_DARKPINK = 0x50 # dark pink.
BACKGROUND_DARKYELLOW = 0x60 # dark yellow.
BACKGROUND_DARKWHITE = 0x70 # dark white.
BACKGROUND_DARKGRAY = 0x80 # dark gray.
BACKGROUND_BLUE = 0x90 # blue.
BACKGROUND_GREEN = 0xa0 # green.
BACKGROUND_SKYBLUE = 0xb0 # skyblue.
BACKGROUND_RED = 0xc0 # red.
BACKGROUND_PINK = 0xd0 # pink.
BACKGROUND_YELLOW = 0xe0 # yellow.
BACKGROUND_WHITE = 0xf0 # white.
# get handle
std_out_handle = ctypes.windll.kernel32.GetStdHandle(STD_OUTPUT_HANDLE)
def set_cmd_text_color(color, handle=std_out_handle):
Bool = ctypes.windll.kernel32.SetConsoleTextAttribute(handle, color)
return Bool
#reset white
def resetColor():
set_cmd_text_color(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE)
###############################################################
#暗蓝色
#dark blue
def printDarkBlue(mess):
set_cmd_text_color(FOREGROUND_DARKBLUE)
sys.stdout.write(mess)
resetColor()
#暗绿色
#dark green
def printDarkGreen(mess):
set_cmd_text_color(FOREGROUND_DARKGREEN)
sys.stdout.write(mess)
resetColor()
#暗天蓝色
#dark sky blue
def printDarkSkyBlue(mess):
set_cmd_text_color(FOREGROUND_DARKSKYBLUE)
sys.stdout.write(mess)
resetColor()
#暗红色
#dark red
def printDarkRed(mess):
set_cmd_text_color(FOREGROUND_DARKRED)
sys.stdout.write(mess)
resetColor()
#暗粉红色
#dark pink
def printDarkPink(mess):
set_cmd_text_color(FOREGROUND_DARKPINK)
sys.stdout.write(mess)
resetColor()
#暗黄色
#dark yellow
def printDarkYellow(mess):
set_cmd_text_color(FOREGROUND_DARKYELLOW)
sys.stdout.write(mess)
resetColor()
#暗白色
#dark white
def printDarkWhite(mess):
set_cmd_text_color(FOREGROUND_DARKWHITE)
sys.stdout.write(mess)
resetColor()
#暗灰色
#dark gray
def printDarkGray(mess):
set_cmd_text_color(FOREGROUND_DARKGRAY)
sys.stdout.write(mess)
resetColor()
#蓝色
#blue
def printBlue(mess):
set_cmd_text_color(FOREGROUND_BLUE)
sys.stdout.write(mess)
resetColor()
#绿色
#green
def printGreen(mess):
set_cmd_text_color(FOREGROUND_GREEN)
sys.stdout.write(mess)
resetColor()
#天蓝色
#sky blue
def printSkyBlue(mess):
set_cmd_text_color(FOREGROUND_SKYBLUE)
sys.stdout.write(mess)
resetColor()
#红色
#red
def printRed(mess):
set_cmd_text_color(FOREGROUND_RED)
sys.stdout.write(mess)
resetColor()
#粉红色
#pink
def printPink(mess):
set_cmd_text_color(FOREGROUND_PINK)
sys.stdout.write(mess)
resetColor()
#黄色
#yellow
def printYellow(mess):
set_cmd_text_color(FOREGROUND_YELLOW)
sys.stdout.write(mess)
resetColor()
#白色
#white
def printWhite(mess):
set_cmd_text_color(FOREGROUND_WHITE)
sys.stdout.write(mess)
resetColor()
##################################################
#白底黑字
#white bkground and black text
def printWhiteBlack(mess):
set_cmd_text_color(FOREGROUND_BLACK | BACKGROUND_WHITE)
sys.stdout.write(mess)
resetColor()
#白底黑字
#white bkground and black text
def printWhiteBlack_2(mess):
set_cmd_text_color(0xf0)
sys.stdout.write(mess)
resetColor()
#黄底蓝字
#white bkground and black text
def printYellowRed(mess):
set_cmd_text_color(BACKGROUND_YELLOW | FOREGROUND_RED)
sys.stdout.write(mess)
resetColor()
if __name__ == '__main__':
a = 'ddd'
printSkyBlue(u'暗蓝色%s\n'%(a))
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。