Windows控制台颜色值是否具有与之关联的正式名称(常数)? [英] Do windows console color values have official names (constants) associated with them?
本文介绍了Windows控制台颜色值是否具有与之关联的正式名称(常数)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
通常,颜色是通过它们的十六进制关联来调用的,但是在代码中是否可以通过Windows控制台API中构建的某些常量来调用这些颜色?
Normally colors are called through their hexadecimal associations, but in the code is it possible to call these colors trough some constants build in windows console API ?
这里是颜色我在搜索时发现的名称: https://stackoverflow.com/a/7138277/393087
Here are colors names I found while searching SO: https://stackoverflow.com/a/7138277/393087
颜色代码:
7 => default
0 => black
1 => blue
2 => green
3 => aqua
4 => red
5 => purple
6 => yellow
7 => light gray
8 => gray
9 => light blue
A => light green
B => light aqua
C => light red
D => light purple
E => light yellow
F => white
这些名字是官方的吗?因此,例如,我可以这样做:
Are these names official ? So for example I could do:
SetConsoleTextAttribute(hConsole,LIGHT_BLUE * 16 + LIGHT_AQUA);
推荐答案
FOREGROUND_BLUE Text color contains blue.
FOREGROUND_GREEN Text color contains green.
FOREGROUND_RED Text color contains red.
FOREGROUND_INTENSITY Text color is intensified.
BACKGROUND_BLUE Background color contains blue.
BACKGROUND_GREEN Background color contains green.
BACKGROUND_RED Background color contains red.
BACKGROUND_INTENSITY Background color is intensified.
这篇关于Windows控制台颜色值是否具有与之关联的正式名称(常数)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文