File: color.h

package info (click to toggle)
ceccomp 4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,648 kB
  • sloc: ansic: 6,531; python: 1,078; makefile: 248; sh: 145
file content (41 lines) | stat: -rw-r--r-- 1,280 bytes parent folder | download
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
#ifndef COLOR_H
#define COLOR_H

#include "parse_args.h"
#include <stdbool.h>
#include <stdio.h>

extern bool color_enable;
extern bool log_color_enable;

extern void set_color (color_mode_t color, FILE *output);

extern void push_color (bool enable);

extern void pop_color (void);

#define CLR "\x1b[0m"

#define REDCLR "\x1b[31m"
#define GREENCLR "\x1b[32m"
#define YELLOWCLR "\x1b[33m"
#define BLUECLR "\x1b[34m"
#define CYANCLR "\x1b[36m"
#define PURPLECLR "\x1b[95m"
#define LIGHTCLR "\x1b[90m"
#define BRIGHT_YELLOWCLR "\x1b[93m"
#define BRIGHT_BLUECLR "\x1b[94m"
#define BRIGHT_CYANCLR "\x1b[96m"

#define RED(str) ((color_enable) ? (REDCLR str CLR) : str)
#define GREEN(str) ((color_enable) ? (GREENCLR str CLR) : str)
#define YELLOW(str) ((color_enable) ? (YELLOWCLR str CLR) : str)
#define BRIGHT_YELLOW(str) ((color_enable) ? (BRIGHT_YELLOWCLR str CLR) : str)
#define BLUE(str) ((color_enable) ? (BLUECLR str CLR) : str)
#define BRIGHT_BLUE(str) ((color_enable) ? (BRIGHT_BLUECLR str CLR) : str)
#define CYAN(str) ((color_enable) ? (CYANCLR str CLR) : str)
#define BRIGHT_CYAN(str) ((color_enable) ? (BRIGHT_CYANCLR str CLR) : str)
#define PURPLE(str) ((color_enable) ? (PURPLECLR str CLR) : str)
#define LIGHT(str) ((color_enable) ? (LIGHTCLR str CLR) : str)

#endif