uni

University stuff
git clone git://git.christosmarg.xyz/uni-assignments.git
Log | Files | Refs | README | LICENSE

ccolors.h (1059B)


      1 #ifndef C_COLORS_H
      2 #define C_COLORS_H
      3 
      4 #include <stdio.h>
      5 
      6 typedef enum {RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, BOLD_RED, BOLD_GREEN, BOLD_YELLOW, BOLD_BLUE, BOLD_MAGENTA, BOLD_CYAN, STANDARD} options;
      7 
      8 __attribute__((always_inline)) void inline set_color(options color) 
      9 {
     10     switch (color)
     11     {
     12         case RED:           printf("\033[0;31m"); break;
     13         case GREEN:         printf("\033[0;32m"); break;
     14         case YELLOW:        printf("\033[0;33m"); break;
     15         case BLUE:          printf("\033[0;34m"); break;
     16         case MAGENTA:       printf("\033[0;35m"); break;
     17         case CYAN:          printf("\033[0;36m"); break;
     18 
     19         case BOLD_RED:      printf("\033[1;31m"); break;
     20         case BOLD_GREEN:    printf("\033[1;32m"); break;
     21         case BOLD_YELLOW:   printf("\033[1;33m"); break;
     22         case BOLD_BLUE:     printf("\033[1;34m"); break;
     23         case BOLD_MAGENTA:  printf("\033[1;35m"); break;
     24         case BOLD_CYAN:     printf("\033[1;36m"); break;
     25 
     26         case STANDARD:      printf("\033[0m");    break;
     27     }
     28 }
     29 
     30 #endif