【发布时间】:2021-08-15 13:34:16
【问题描述】:
下面的代码只能改变带有颜色的属性。
init_color(1, 255);
init_color(2, 1);
init_pair(1, 1, 2);
attron(COLOR_PAIR(1)); // only change the pair of foreground and background color
addstr("aaa");
attron(A_BOLD); // only change the attribute
addstr("aaa");
attrset(COLOR_PAIR(1)|A_BOLD); // change both
我想知道我们是否可以只更改前景色,但保留背景色。
attron_fg(BACKGROUND_YELLOW); // only change the foreground color
addstr("aaa");
【问题讨论】: