12,501,105 members (44,567 online)
Rate this:
See more:
How can we colour the output that is to be displayed on the screen?
Posted 30-Dec-12 20:28pm

It depends where and how you display the output.
—SA
aspnet_regiis -i 31-Dec-12 3:58am

Use colors..

Rate this:

## Solution 1

```textcolor(9); /* any number between 0 to 15)*/
v2
Rate this:

## Solution 2

```#include <stdio.h>

#define ANSI_COLOR_RED     "\x1b[31m"
#define ANSI_COLOR_GREEN   "\x1b[32m"
#define ANSI_COLOR_YELLOW  "\x1b[33m"
#define ANSI_COLOR_BLUE    "\x1b[34m"
#define ANSI_COLOR_MAGENTA "\x1b[35m"
#define ANSI_COLOR_CYAN    "\x1b[36m"
#define ANSI_COLOR_RESET   "\x1b[0m"

int main (int argc, char const *argv[]) {

printf(ANSI_COLOR_RED     "This text is RED!"     ANSI_COLOR_RESET "\n");
printf(ANSI_COLOR_GREEN   "This text is GREEN!"   ANSI_COLOR_RESET "\n");
printf(ANSI_COLOR_YELLOW  "This text is YELLOW!"  ANSI_COLOR_RESET "\n");
printf(ANSI_COLOR_BLUE    "This text is BLUE!"    ANSI_COLOR_RESET "\n");
printf(ANSI_COLOR_MAGENTA "This text is MAGENTA!" ANSI_COLOR_RESET "\n");
printf(ANSI_COLOR_CYAN    "This text is CYAN!"    ANSI_COLOR_RESET "\n");

return 0;
}```

or have a tutorial Output Colorful Text using C Program [^]
Member 9720070 17-Jan-13 16:43pm

Which are the header files required for cprintf and textcolor?

Top Experts
Last 24hrsThis month
 OriginalGriff 228 David_Wimbley 205 Karthik Bangalore 105 Richard MacCutchan 85 Mehdi Gholam 50
 OriginalGriff 6,548 ppolymorphe 3,669 Maciej Los 3,283 David_Wimbley 2,647 Karthik Bangalore 2,569