Skip to content

Commit ae333ba

Browse files
Added color terminal functions.
Allows manual changes in terminal settings and terminal clearing.
1 parent acd5e4e commit ae333ba

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

lib_term_color.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#include <stdio.h>
2+
3+
#define RESET 0
4+
#define BRIGHT 1
5+
#define DIM 2
6+
#define UNDERLINE 3
7+
#define BLINK 4
8+
#define REVERSE 7
9+
#define HIDDENT 8
10+
11+
#define BLACK 0
12+
#define RED 1
13+
#define GREEN 2
14+
#define YELLOW 3
15+
#define BLUE 4
16+
#define MAGENTA 5
17+
#define CYAN 6
18+
#define WHITE 7
19+
20+
void clear_screen()
21+
{
22+
system("clear");
23+
}
24+
25+
void color(int attr, int fg, int bg)
26+
{
27+
printf("%c[%d;%d;%dm", 0x1B, attr, fg+30, bg+40);
28+
}

0 commit comments

Comments
 (0)