Luma
0.1.0
A low-level compiled alternative to C, C++, and more!
Loading...
Searching...
No Matches
src
c_libs
color
color.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <stdbool.h>
4
5
#ifdef __cplusplus
6
extern
"C"
{
7
#endif
8
29
#define COLOR_RED "\033[31m"
30
#define COLOR_GREEN "\033[32m"
31
#define COLOR_BLUE "\033[34m"
32
#define COLOR_CYAN "\033[36m"
33
#define COLOR_MAGENTA "\033[35m"
34
#define COLOR_YELLOW "\033[33m"
35
#define COLOR_WHITE "\033[37m"
36
#define COLOR_BLACK "\033[30m"
37
#define COLOR_GRAY "\033[90m"
42
#define STYLE_RESET "\033[0m"
43
#define STYLE_BOLD "\033[1m"
44
#define STYLE_UNDERLINE "\033[4m"
49
#define BG_RED "\033[41m"
50
#define BG_GREEN "\033[42m"
51
#define BG_BLUE "\033[44m"
52
#define BG_CYAN "\033[46m"
53
#define BG_MAGENTA "\033[45m"
54
#define BG_YELLOW "\033[43m"
55
#define BG_WHITE "\033[47m"
56
#define BG_BLACK "\033[40m"
57
#define BG_GRAY "\033[100m"
66
#define RED(text) (terminal_supports_color() ? COLOR_RED text STYLE_RESET : text)
67
#define GREEN(text) (terminal_supports_color() ? COLOR_GREEN text STYLE_RESET : text)
68
#define BLUE(text) (terminal_supports_color() ? COLOR_BLUE text STYLE_RESET : text)
69
#define CYAN(text) (terminal_supports_color() ? COLOR_CYAN text STYLE_RESET : text)
70
#define MAGENTA(text) (terminal_supports_color() ? COLOR_MAGENTA text STYLE_RESET : text)
71
#define YELLOW(text) (terminal_supports_color() ? COLOR_YELLOW text STYLE_RESET : text)
72
#define WHITE(text) (terminal_supports_color() ? COLOR_WHITE text STYLE_RESET : text)
73
#define BLACK(text) (terminal_supports_color() ? COLOR_BLACK text STYLE_RESET : text)
74
#define GRAY(text) (terminal_supports_color() ? COLOR_GRAY text STYLE_RESET : text)
82
#define BOLD_RED(text) (terminal_supports_color() ? STYLE_BOLD COLOR_RED text STYLE_RESET : text)
83
#define BOLD_GREEN(text) (terminal_supports_color() ? STYLE_BOLD COLOR_GREEN text STYLE_RESET : text)
84
#define BOLD_BLUE(text) (terminal_supports_color() ? STYLE_BOLD COLOR_BLUE text STYLE_RESET : text)
85
#define BOLD_CYAN(text) (terminal_supports_color() ? STYLE_BOLD COLOR_CYAN text STYLE_RESET : text)
86
#define BOLD_MAGENTA(text) (terminal_supports_color() ? STYLE_BOLD COLOR_MAGENTA text STYLE_RESET : text)
87
#define BOLD_YELLOW(text) (terminal_supports_color() ? STYLE_BOLD COLOR_YELLOW text STYLE_RESET : text)
88
#define BOLD_WHITE(text) (terminal_supports_color() ? STYLE_BOLD COLOR_WHITE text STYLE_RESET : text)
89
#define BOLD_BLACK(text) (terminal_supports_color() ? STYLE_BOLD COLOR_BLACK text STYLE_RESET : text)
90
#define BOLD_GRAY(text) (terminal_supports_color() ? STYLE_BOLD COLOR_GRAY text STYLE_RESET : text)
98
#define UNDERLINE_RED(text) (terminal_supports_color() ? STYLE_UNDERLINE COLOR_RED text STYLE_RESET : text)
99
#define UNDERLINE_GREEN(text) (terminal_supports_color() ? STYLE_UNDERLINE COLOR_GREEN text STYLE_RESET : text)
100
#define UNDERLINE_BLUE(text) (terminal_supports_color() ? STYLE_UNDERLINE COLOR_BLUE text STYLE_RESET : text)
101
#define UNDERLINE_CYAN(text) (terminal_supports_color() ? STYLE_UNDERLINE COLOR_CYAN text STYLE_RESET : text)
102
#define UNDERLINE_MAGENTA(text) (terminal_supports_color() ? STYLE_UNDERLINE COLOR_MAGENTA text STYLE_RESET : text)
103
#define UNDERLINE_YELLOW(text) (terminal_supports_color() ? STYLE_UNDERLINE COLOR_YELLOW text STYLE_RESET : text)
104
#define UNDERLINE_WHITE(text) (terminal_supports_color() ? STYLE_UNDERLINE COLOR_WHITE text STYLE_RESET : text)
105
#define UNDERLINE_BLACK(text) (terminal_supports_color() ? STYLE_UNDERLINE COLOR_BLACK text STYLE_RESET : text)
106
#define UNDERLINE_GRAY(text) (terminal_supports_color() ? STYLE_UNDERLINE COLOR_GRAY text STYLE_RESET : text)
114
#define COLORIZE(color, text) (terminal_supports_color() ? color text STYLE_RESET : text)
115
#define BOLD_COLORIZE(color, text) (terminal_supports_color() ? STYLE_BOLD color text STYLE_RESET : text)
116
#define UNDERLINE_COLORIZE(color, text) (terminal_supports_color() ? STYLE_UNDERLINE color text STYLE_RESET : text)
117
#define STYLE_COLORIZE(style, color, text) (terminal_supports_color() ? style color text STYLE_RESET : text)
129
bool
terminal_supports_color
(
void
);
130
131
#ifdef __cplusplus
132
}
133
#endif
terminal_supports_color
bool terminal_supports_color(void)
Checks if the terminal supports ANSI color escape sequences.
Definition
color.c:53
Generated by
1.9.8