tbackground.pp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. uses
  2. ncurses, sysutils;
  3. var
  4. f, b: Smallint;
  5. begin
  6. initscr();
  7. cbreak();
  8. noecho();
  9. if (has_colors()) then
  10. begin
  11. start_color();
  12. pair_content(0, @f, @b);
  13. printw(PChar('pair 0 contains (%d,%d)'#10), f, b);
  14. getch();
  15. printw('Initializing pair 1 to red/black'#10);
  16. init_pair(1, COLOR_RED, COLOR_BLACK);
  17. bkgdset(chtype(' ') OR COLOR_PAIR(1));
  18. printw('RED/BLACK'#10);
  19. getch();
  20. printw('Initializing pair 2 to white/blue'#10);
  21. init_pair(2, COLOR_WHITE, COLOR_BLUE);
  22. bkgdset(chtype(' ') OR COLOR_PAIR(2));
  23. printw('WHITE/BLUE'#10);
  24. getch();
  25. printw('Resetting colors to pair 0'#10);
  26. bkgdset(chtype(' ') OR COLOR_PAIR(0));
  27. printw('Default Colors'#10);
  28. getch();
  29. printw('Resetting colors to pair 1'#10);
  30. bkgdset(chtype(' ') OR COLOR_PAIR(1));
  31. printw('RED/BLACK'#10);
  32. getch();
  33. printw('Setting screen to pair 0'#10);
  34. bkgd(chtype(' ') OR COLOR_PAIR(0));
  35. getch();
  36. printw('Setting screen to pair 1'#10);
  37. bkgd(chtype(' ') OR COLOR_PAIR(1));
  38. getch();
  39. printw('Setting screen to pair 2'#10);
  40. bkgd(chtype(' ') OR COLOR_PAIR(2));
  41. getch();
  42. printw('Setting screen to pair 0'#10);
  43. bkgd(chtype(' ') OR COLOR_PAIR(0));
  44. getch();
  45. end
  46. else
  47. begin
  48. printw('This demo requires a color terminal'#10);
  49. getch();
  50. end;
  51. endwin();
  52. end.