Advertisement
j0h

PrintColors.c

j0h
Apr 23rd, 2023 (edited)
1,112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.78 KB | None | 0 0
  1. #include <stdio.h>
  2. //C Colours .h
  3. //Effects: if the previos color setting isnt cleared, you get combined effects
  4.  
  5. //Clear as in Reset the color to system setting, not as in the color clear
  6. #define CLEAR  "\033[0m"
  7.  
  8. //double underscore
  9. #define UNDERLINE_2 "\033[0;21m"
  10.  
  11. //text colorized
  12. #define BLACK  "\033[0;30m"
  13. #define RED    "\033[0;31m"
  14. #define GREEN  "\033[0;32m"
  15. #define YELLOW "\033[0;33m"
  16. #define BLUE   "\033[0;34m"
  17. #define PURPLE "\033[0;35m"
  18. #define CYAN   "\033[0;36m"
  19. #define WHITE  "\033[0;37m"
  20.  
  21. //text is system color, highlighted in color
  22. #define HIGHLIGHT_BLACK  "\033[0;40m"
  23. #define HIGHLIGHT_RED    "\033[0;41m"
  24. #define HIGHLIGHT_GREEN  "\033[0;42m"
  25. #define HIGHLIGHT_YELLOW "\033[0;43m"
  26. #define HIGHLIGHT_BLUE   "\033[0;44m"
  27. #define HIGHLIGHT_PURPLE "\033[0;45m"
  28. #define HIGHLIGHT_CYAN   "\033[0;46m"
  29. #define HIGHLIGHT_WHITE  "\033[0;47m"
  30.  
  31. //single underscore
  32. #define UNDERLINE "\033[0;52m"
  33.  
  34. #define BLACK_BOLD  "\033[1;90m"
  35. #define RED_BOLD    "\033[1;91m"
  36. #define GREEN_BOLD  "\033[1;92m"
  37. #define YELLOW_BOLD "\033[1;93m"
  38. #define BLUE_BOLD   "\033[1;94m"
  39. #define PURPLE_BOLD "\033[1;95m"
  40. #define CYAN_BOLD   "\033[1;96m"
  41. #define WHITE_BOLD  "\033[1;97m"
  42.  
  43.  
  44.  
  45. int main(){
  46. char *a[27]={
  47. CLEAR, UNDERLINE_2, BLACK, RED, GREEN, YELLOW, BLUE, PURPLE, CYAN, WHITE,
  48. HIGHLIGHT_BLACK, HIGHLIGHT_RED, HIGHLIGHT_GREEN, HIGHLIGHT_YELLOW,
  49. HIGHLIGHT_BLUE, HIGHLIGHT_PURPLE,HIGHLIGHT_CYAN, HIGHLIGHT_WHITE,
  50. BLACK_BOLD, RED_BOLD, GREEN_BOLD, YELLOW_BOLD, BLUE_BOLD, PURPLE_BOLD,
  51. CYAN_BOLD, WHITE_BOLD, UNDERLINE
  52. };
  53. printf(RED);
  54. printf("Lib Color\n");
  55.   printf(CLEAR);
  56.   for (int i=10; i<14; i++){
  57. printf("%s",a[i]);
  58. printf("\nHello world\n");
  59. printf("%s",a[0]);
  60. }
  61. //Red on Red
  62.  
  63. printf(RED_BOLD);
  64. printf("TEXT LOL");
  65.   printf(CLEAR);
  66.   return 0;
  67.  }
  68.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement