任何人都知道在哪里可以找到描述如何使用API和/或stdout在Windows CLI界面上输出颜色的参考?
The Win32 console API has a function, SetConsoleTextAttribute , that can be used to set the text foreground and background colours. Sample code is here .
At least there is the color command:
color bg fg
where:
0: Black
1: Blue
2: Green
3: Cyan
4: Red
5: Purple
6: Yellow
7: Gray
8: Silver
9: Light blue
A: Lime
B: Light cyan
C: Light red
D: Light purple
E: Light yellow
F: White
Example:
color 80
Gives a silver background with black text.
Not exactly a reference but it should help you find what you're looking for on MSDN, check out:
http://www.gamedev.net/community/forums/topic.asp?topic_id=457528 .
You probably want to look up "WriteConsoleOutput".
在powershell中,write-host采用-backgroundcolor和-foregroundcolor参数
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.