pretty.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /* vccd/include/vcc/pretty.h
  2. *
  3. * This file is part of vcc.
  4. *
  5. * vcc is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * vcc is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with vcc. If not, see <https://www.gnu.org/licenses/>
  17. */
  18. #ifndef __VCC_PRETTY_H
  19. #define __VCC_PRETTY_H
  20. #include <stdio.h>
  21. #define FG_BLACK 30
  22. #define FG_RED 31
  23. #define FG_GREEN 32
  24. #define FG_YELLOW 33
  25. #define FG_BLUE 34
  26. #define FG_MAGENTA 35
  27. #define FG_LIGHTBLUE 36
  28. #define FG_WHITE 37
  29. #define FG_GRAY 90
  30. #define BG_BLACK 40
  31. #define BG_RED 41
  32. #define BG_GREEN 42
  33. #define BG_YELLOW 43
  34. #define BG_BLUE 44
  35. #define BG_MAGENTA 45
  36. #define BG_LIGHTBLUE 46
  37. #define BG_WHITE 47
  38. #define BG_GRAY 100
  39. #define MODE_DEFAULT 0
  40. #define MODE_HIGHLIGHT 1
  41. #define MODE_LINE 4
  42. #define MODE_BLINK 5
  43. #define ansi_csi_st(strm, m, fg, bg) \
  44. fprintf(strm, "\033[%d;%d;%dm", m, fg, bg)
  45. #define ansi_csi_ed(strm) \
  46. fprintf(strm, "\033[0m")
  47. #define setcolor(strm, c) \
  48. ansi_csi_st(strm, (c)->mode, (c)->fg, (c)->bg)
  49. #define MSG_NEW_RELAY 1
  50. #define MSG_NEW_ONLY_VISIBLE 2
  51. #define MSG_ENCRYPTED 4
  52. struct color {
  53. int fg;
  54. int bg;
  55. int mode;
  56. };
  57. struct theme {
  58. struct color usrname,
  59. sysusername,
  60. msg,
  61. sysmsg,
  62. sid,
  63. lvl,
  64. time,
  65. relay,
  66. errmsg,
  67. helpcmd,
  68. helpmsg,
  69. cqd;
  70. };
  71. #define NR_THEMES 12
  72. int pretty_new_msg(char *usrname, char *msg, int sid, int flags);
  73. int pretty_prompt(char *usrname);
  74. int pretty_unknown_cmd(char *cmd);
  75. int pretty_cmd_help(char *cmd, char *msg);
  76. int pretty_cqd(char *usrname);
  77. #endif