-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcommon.h
69 lines (44 loc) · 1.39 KB
/
common.h
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef COMMON_H
#define COMMON_H
#include <string.h>
#include <stdio.h>
#include <termios.h>
#include <unistd.h>
#include <assert.h>
#define TEXT_BLACK "\033[30m"
#define TEXT_RED "\033[31m"
#define TEXT_GREEN "\033[32m"
#define TEXT_YELLOW "\033[33m"
#define TEXT_BLUE "\033[34m"
#define TEXT_PURPLE "\033[35m"
#define TEXT_DARKGREEN "\033[36m"
#define TEXT_WHITE "\033[37m"
#define COLOR_RESET "\033[0m"
#define CURSOR_HIDE "\33[?25l"
#define CURSOR_SHOW "\33[?25h"
#define CURSOR_SAVE "\33[s"
#define CURSOR_LOAD "\33[u"
#define BACKGRPUND_BLACK "\033[40m"
#define BACKGRPUND_RED "\033[41m"
#define BACKGRPUND_GREEN "\033[42m"
#define BACKGRPUND_YELLOW "\033[43m"
#define BACKGRPUND_BLUE "\033[44m"
#define BACKGRPUND_PURPLE "\033[45m"
#define BACKGRPUND_DARKGREEN "\033[46m"
#define BACKGRPUND_WHITE "\033[47m"
#define dim(arr) (sizeof(arr)/sizeof(arr[0]))
#define get_color(color,n) (snprintf(color,sizeof(color),"\033[3%dm",n))
int str_ends_with(const char * str, const char * suffix);
void cls(void);
int getch(void);
int hide_cursor(void);
int show_cursor(void);
void save_cursor();
void load_cursor();
void set_cursor_point(int x, int y);
void backgroud_color(char* color);
void textcolor(char *text, char* color);
void color_reset();
void printf_red(char *str);
void printf_blue(char *str);
#endif