C Programming / Linux – Color Text Output (printf)

I'm Using GNOME Terminal 3.20.3 and Fedora 24.

#include <stdio.h>
char fail_color[] = "\033[31;1m";
char pass_color[] = "\033[32;1m";
char color_end[] = "\033[0m";
char Yellow[] = "\033[33;1m";
char Blue[] = "\033[34;1m";
char Purple[] = "\033[35;1m";
char White[] = "\033[37;1m";
char DarkGray[] = "\033[30;1m";
char Y_highligth[] = "\033[33;7m";
int main(int argc, char const *argv[]) {
  printf("%sPass\n%sFail\n%sNormal\n",pass_color, fail_color, color_end);
  printf("%sYellow\n", Yellow);
  printf("%sBlue\n", Blue);
  printf("%sPurple\n", Purple);
  printf("%sWhite\n", White);
  printf("%sDarkGray\n", DarkGray);
  printf("%sYellow highligth\n", Y_highligth);
  return 0;

OutPut :


Popular posts from this blog

Fedora 24, Vibrancy-Kali Linux Icon

How To Make IoT Messaging with BashShell

How To Make IoT Tweet with Python