Created
August 19, 2017 11:24
-
-
Save ilansmith/313039c3b5493e2c745b559a958bd939 to your computer and use it in GitHub Desktop.
Shell Colours
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define CLEAR "\033[00;00;00m" | |
static void p_colour(int c1, int c2) | |
{ | |
char col[10]; | |
sprintf(col, "\033[%d;%dm", c1, c2); | |
printf("\"\\033[%d;%dm\" = %scolour%s\n", c1, c2, col, CLEAR); | |
fflush(stdout); | |
} | |
static void test(void) | |
{ | |
#define COL_BLINK "\033[00;05m" | |
#define COL_RED "\033[01;29;41m" | |
printf("%s%s_%s\n", COL_BLINK, COL_RED, CLEAR); | |
fflush(stdout); | |
} | |
int main(int argc, char *argv[]) | |
{ | |
int i, j; | |
for (i = 0; i < 9; i++) { | |
for (j = 0; j < 80; j++) | |
p_colour(i, j); | |
} | |
test(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment