Search
 
SCRIPT & CODE EXAMPLE
 

C

color text in C

#include <stdio.h>

//defining all combinations to be used.
#define RED   "x1B[31m"
#define GRN   "x1B[32m"
#define YEL   "x1B[33m"
#define BLU   "x1B[34m"
#define MAG   "x1B[35m"
#define CYN   "x1B[36m"
#define WHT   "x1B[37m"
#define RESET "x1B[0m"

int main() {
	//Using defines very easily without a need for '%s' of 'x1B[...'
    printf(RED "red
"     RESET);
    printf(GRN "green
"   RESET);
    printf(YEL "yellow
"  RESET);
    printf(BLU "blue
"    RESET);
    printf(MAG "magenta
" RESET);
    printf(CYN "cyan
"    RESET);
    printf(WHT "white
"   RESET);
	
  	return 0;
}
Comment

PREVIOUS NEXT
Code Example
C :: c colourful text 
C :: reset style matplotlib 
C :: pi in c language 
C :: unity change transparency script 
C :: What are the 3 basic types of Plate Boundaries? Explain their differences (how they act). 
C :: how to set a pointer to an offset in c 
C :: manifest orientation portrait 
C :: wireless app debug android 
C :: c program hide console window 
C :: variably modified ‘_memory’ at file scope 
C :: sdl draw Rectf 
C :: octave sum all elements in matrix 
C :: yourkill071 
C :: c static 
C :: how to find sum of two nums 
C :: atomic variable c 
C :: console log observable data 
C :: c output 
C :: get range of values in mongodb 
C :: sequelize count multiple associations 
C :: c if else 
C :: c memset 
C :: C Programming to swap two variables 
C :: c read n bytes code 
C :: c convert float to string 
C :: c find last element in array 
C :: add to beginning of array c 
C :: replace a substring with another substring in c 
C :: c program to implement mv command 
C :: c str add int 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =