summaryrefslogtreecommitdiffstats
path: root/lib/tty/color.h
blob: e09516f6e643002b8bb3ab1f4014814b8fdf4a68 (plain)
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
/** \file color.h
 *  \brief Header: color setup
 *
 * PLEASE FORGOT ABOUT tty/color.h!
 * Use skin engine for getting needed color pairs.
 *
 * edit/syntax.c may use this file directly, I'm agree. :)
 *
 */

#ifndef MC__COLOR_H
#define MC__COLOR_H

#include "lib/global.h"         /* glib.h */

#ifdef HAVE_SLANG
#include "color-slang.h"
#else
#include "tty-ncurses.h"
#endif

/*** typedefs(not structures) and defined constants **********************************************/

typedef struct
{
    char *fg;
    char *bg;
    char *attrs;
    size_t pair_index;
} tty_color_pair_t;

/*** enums ***************************************************************************************/

/*** structures declarations (and typedefs of structures)*****************************************/

/*** global variables defined in .c file *********************************************************/

/*** declarations of public functions ************************************************************/

void tty_init_colors (gboolean disable, gboolean force);
void tty_colors_done (void);

gboolean tty_use_colors (void);
int tty_try_alloc_color_pair (const tty_color_pair_t * color, gboolean is_temp);

void tty_color_free_temp (void);
void tty_color_free_all (void);

void tty_setcolor (int color);
void tty_lowlevel_setcolor (int color);
void tty_set_normal_attrs (void);

void tty_color_set_defaults (const tty_color_pair_t * color);

extern gboolean tty_use_256colors (GError ** error);
extern gboolean tty_use_truecolors (GError ** error);

/*** inline functions ****************************************************************************/

#endif /* MC__COLOR_H */