43_colors.c 504 B

1234567891011121314151617181920212223
  1. #include <ncurses.h>
  2. int main()
  3. {
  4. initscr();
  5. start_color();
  6. init_pair(1, COLOR_YELLOW, COLOR_BLACK);
  7. init_pair(2, COLOR_BLACK, COLOR_GREEN);
  8. attron(COLOR_PAIR(1));
  9. printw("Yellow text on black background\n");
  10. attroff(COLOR_PAIR(1));
  11. attron(COLOR_PAIR(2));
  12. printw("Black text on green background\n");
  13. attroff(COLOR_PAIR(2));
  14. refresh();
  15. int ch;
  16. while ((ch = getch()) == KEY_RESIZE)
  17. {
  18. // KEY_RESIZE event usually appears when keyboard shows in Terminal on Android
  19. }
  20. endwin();
  21. return 0;
  22. }