/* This program does something =) */ #include #define loc "[5;23f" /* define row and column */ #define erasetoend "[0J" /* clear the screen */ #define cursorhome "[0H" /* send the cursor home */ #define clearscreen "[2J" /* clear screen and send curor home */ #define revvideo "[7m" /* reverse video */ #define reset "[0m" #define bold "[1m" #define underline "[4m" #define black "[30m" #define red "[0;31m" #define green "[0;32m" #define brown "[0;33m" #define blue "[0;34m" #define purple "[0;35m" #define cyan "[0;36m" #define yellow "[1;33m" /* bold yellow */ #define bred "[1;31m" #define bgreen "[1;32m" #define bblue "[1;34m" #define bpurple "[1;35m" #define bcyan "[1;36m" #define bwhite "[1;37m" #define dred "[30;31m" /* same as plain red */ #define dgreen "[30;32m" /* same as plain green */ #define dblue "[30;34m" /* same as plain blue */ #define dpurple "[30;35m" /* same as plain purple */ #define dcyan "[30;36m" /* same as plain cyan */ #define grey "[30;37m" /* Black  Dark Gray  Blue  Light Blue  Green  Light Green  Cyan  Light Cyan  Red  Light Red  Purple  Light Purple  Brown  Yellow  Light Gray  White  Black background Dark Gray text  Black background Light Red text  Black background Light Green text  Black background Yellow text  Black background Light Blue text  Black background Light Purple text  Black background Light Cyan text  Black background White text  Dark Red background Dark Gray text  Dark Red background Light Red text  Dark Red background Light Green text  Dark Red background Yellow text  Dark Red background Light Blue text  Dark Red background Light Purple text  Dark Red background Light Cyan text  Dark Red background White text  Green background Dark Gray text  Green background Light Red text  Green background Light Green text  Green background Yellow text  Green background Light Blue text  Green background Light Purple text  Green background Light Cyan text  Green background White text  Brown background Dark Gray text  Brown background Light Red text  Brown background Light Green text  Brown background Yellow text  Brown background Light Blue text  Brown background Light Purple text  Brown background Light Cyan text  Brown background White text  Blue background Dark Gray text  Blue background Light Red text  Blue background Light Green text  Blue background Yellow text  Blue background Light Blue text  Blue background Light Purple text  Blue background Light Cyan text  Blue background White text  Purple background Dark Gray text  Purple background Light Red text  Purple background Light Green text  Purple background Yellow text  Purple background Light Blue text  Purple background Light Purple text  Purple background Light Cyan text  Purple background White text  Cyan background Dark Gray text  Cyan background Light Red text  Cyan background Light Green text  Cyan background Yellow text  Cyan background Light Blue text  Cyan background Light Purple text  Cyan background Light Cyan text  Cyan background White text  Grey background Dark Gray text  Grey background Light Red text  Grey background Light Green text  Grey background Yellow text  Grey background Light Blue text  Grey background Light Purple text  Grey background Light Cyan text  Grey background White text  */ char esc = 27; /* escape character */ char bell = 7; /* the bell */ char ret; /* holds return key */ int main(){ printf("%c%s",esc,clearscreen); /*clear screen*/ puts("ESC characters\n\n"); printf("%c%sBlack%c%s<-- Black\n",esc,black,esc,reset); printf("%c%sGrey%c%s\n",esc,grey,esc,reset); printf("%c%sRed\n",esc,red); printf("%c%sGreen\n",esc,green); printf("%c%sBlue\n",esc,blue); printf("%c%sPurple\n",esc,purple); printf("%c%sCyan\n",esc,cyan); printf("%c%sBrown%c%s\n",esc,brown,esc,reset); puts("-Hit Return Key-"); scanf("%c",&ret); /*read carriage ret.*/ printf("%c", bell); printf("%c%s%c%sBold Plain Text\n",esc,reset,esc,bold); printf("%c%sBold Black%c%s\n",esc,black,esc,reset); /* This will show but will look dark grey */ printf("%c%sBold Yellow\n",esc,yellow); printf("%c%sBold Red\n",esc,bred); printf("%c%sBold Green\n",esc,bgreen); printf("%c%sBold Blue\n",esc,bblue); printf("%c%sBold Purple\n",esc,bpurple); printf("%c%sBold Cyan\n",esc,bcyan); printf("%c%sBold White%c%s\n\n",esc,bwhite,esc,reset); puts("-Hit Return Key-"); scanf("%c",&ret); /*read carriage ret.*/ printf("%c", bell); printf("%c%s",esc,revvideo); /* reverse the color, doesn't work on color thats not in bold */ printf("%c%s%c%s reverse Bold Black \n",esc,bold,esc,black); printf("%c%s reverse Yellow \n",esc,yellow); printf("%c%s reverse Red \n",esc,bred); printf("%c%s reverse Green \n",esc,bgreen); printf("%c%s reverse Blue \n",esc,bblue); printf("%c%s reverse Purple \n",esc,bpurple); printf("%c%s reverse Cyan \n",esc,bcyan); printf("%c%s reverse White %c%s\n",esc,bwhite,esc,reset); printf("%c%s",esc,revvideo); printf("%c%s reverse Bold Text %c%s\n\n",esc,bold,esc,reset); /* had to turn off white for this to work */ puts("-Hit Return Key-"); scanf("%c",&ret); /*read carriage ret.*/ printf("%c", bell); printf("%c%sUnderlined Plain text\n",esc,underline); printf("%c%sUndelined Bold\n",esc,bold); /* the rest of the colors need to be in bold */ printf("%c%sUndelined Bold Black\n",esc,black); printf("%c%sUndelined Bold Red\n",esc,bred); printf("%c%sUndelined Bold Green\n",esc,bgreen); printf("%c%sUndelined Bold Blue\n",esc,bblue); printf("%c%sUndelined Bold Purple\n",esc,bpurple); printf("%c%sUndelined Bold Cyan\n",esc,bcyan); printf("%c%sUndelined Bold White%c%s\n",esc,bwhite,esc,reset); printf("%c", bell); puts("\nFear The Col0rs"); }