1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
#include <stdio.h>
#define BLACK 0
#define RED 1
#define GREEN 2
#define YELLOW 3
#define BLUE 4
#define MAGENTA 5
#define CYAN 6
#define WHITE 7
#define NORMAL 0
#define BOLD 1
#define UNDERSCORE 4
#define BLINK 5
#define REVERSE 7
void text_out(int attr, int fcol, int bcol, const char* msg)
{
printf("\033[%i;3%i;4%im%s\033[0m\n", attr, fcol, bcol, msg);
}
int main()
{
text_out(NORMAL, YELLOW, BLUE, "Hello world!");
text_out(BOLD, RED, YELLOW, "Bonjour le monde !");
text_out(BLINK, WHITE, RED, "Hej varlden!");
text_out(REVERSE, GREEN, MAGENTA, "Wapendwa ulimwengu!");
text_out(UNDERSCORE, BLACK, GREEN, "Hallo Welt !");
return 0;
}
|