这些花花玩意儿没啥可说的,都在代码里了。
/*
character style
------------------
default 0
bold 1
underline 4
flash 5
reverse 7
color
------------------
red 1
green 2
yellow 3
blue 4
magenta 5
cyan 6
30 + color forecolor
40 + color backcolor
*/
#include <termios.h>
int main(void){
int i,j;
char *color[] = {"RED", "GREEN", "YELLOW", "BLUE", "MAGENTA", "CYAN"};
printf("\033[1mBold\033[0m");
printf("\033[4mUnderline\033[0m");
printf("\033[5mFlash\033[0m\n");
// chessborad
for(i = 0; i < 8; ++i){
for(j = 0; j < 8; ++j){
printf("\033[%dm ", (i + j) % 2 ? 7 : 0);
}
printf("\n");
}
// colorful stripe
for(i = 1; i <= 6; ++i){
if(i % 2)
j = i + 1;
else
j = i - 1;
printf("\033[%dm\033[%dm%8s\033[0m", 40 + i, 30 + j, color[i - 1]);
}
return 0;
}
character style
------------------
default 0
bold 1
underline 4
flash 5
reverse 7
color
------------------
red 1
green 2
yellow 3
blue 4
magenta 5
cyan 6
30 + color forecolor
40 + color backcolor
*/
#include <termios.h>
int main(void){
int i,j;
char *color[] = {"RED", "GREEN", "YELLOW", "BLUE", "MAGENTA", "CYAN"};
printf("\033[1mBold\033[0m");
printf("\033[4mUnderline\033[0m");
printf("\033[5mFlash\033[0m\n");
// chessborad
for(i = 0; i < 8; ++i){
for(j = 0; j < 8; ++j){
printf("\033[%dm ", (i + j) % 2 ? 7 : 0);
}
printf("\n");
}
// colorful stripe
for(i = 1; i <= 6; ++i){
if(i % 2)
j = i + 1;
else
j = i - 1;
printf("\033[%dm\033[%dm%8s\033[0m", 40 + i, 30 + j, color[i - 1]);
}
return 0;
}