[英]Ncurses C++ print text with foreground/background colors swapped
I would like to be able to print text with foreground/background colors swapped, like for example, the top bar in nano
. 我希望能够以交换前景色/背景色的方式打印文本,例如
nano
的顶部栏。 But I want to use the default terminal colors. 但是我想使用默认的终端颜色。 I am already calling
use_default_colors()
. 我已经在调用
use_default_colors()
。 Calling pair_content(0, &c1, &c2)
just gives me c1=-1, c2=-1
, so I don't have any values to pass in to init_pair()
, since -1 means both default foreground and background color. 调用
pair_content(0, &c1, &c2)
只会给我c1=-1, c2=-1
,所以我没有任何值可以传递给init_pair()
,因为-1表示默认的前景色和背景色。 How can I swap those colors in another color pair, or how can I get default foreground/background color rgb values so I can reinitialize some colors to be the default terminal foreground and background colors? 如何将这些颜色交换为另一对颜色,或者如何获得默认的前景色/背景色rgb值,以便可以将一些颜色重新初始化为默认的终端前景色和背景色?
short: color pairs don't do that. 简短:颜色对不能做到这一点。
longer: you could apply the attribute for reverse-video A_REVERSE
, but it's not a color. 更长:您可以将属性应用于反向视频
A_REVERSE
,但这不是颜色。 It gets passed around as easily as color pairs. 它像颜色对一样容易传递。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.