cueses库函数中包含改变字体颜色的函数,可以直接调用,
下面是例程
#include <stdio.h>
#include <curses.h>
int main()
{
initscr();
move(LINES/2,COLS/2);
if(start_color() == OK)
{
init_pair(1,COLOR_RED,COLOR_BLACK);
attron(COLOR_PAIR(1));
move(LINES/2,COLS/2);
addstr("hello!");
addroff(COLOR_PAIR(1));
refresh();
}
addstr("hello!");
winend();
return 0;
}
使用curses库改变字体颜色
本文介绍如何利用curses库中的函数实现控制台应用程序字体颜色的改变,并提供了具体的示例代码。文中详细展示了如何定义颜色对并将其应用于字符串显示。

2050

被折叠的 条评论
为什么被折叠?



