summaryrefslogtreecommitdiffstats
path: root/lib/tty/color-internal.h
blob: a9b8d690798abed4b7aac49fa6691cc5b78f7954 (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
61
62
/** \file color-internal.h
 *  \brief Header: Internal stuff of color setup
 */

#ifndef MC__COLOR_INTERNAL_H
#define MC__COLOR_INTERNAL_H

#include <sys/types.h>          /* size_t */

#include "lib/global.h"

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

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

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

/* *INDENT-OFF* */
typedef enum {
    SPEC_A_REVERSE              = -100,
    SPEC_A_BOLD                 = -101,
    SPEC_A_BOLD_REVERSE         = -102,
    SPEC_A_UNDERLINE            = -103
} tty_special_color_t;
/* *INDENT-ON* */

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

/* Screen library specific color pair */
typedef struct
{
    int fg;
    int bg;
    int attr;
    size_t pair_index;
    gboolean is_temp;
} tty_color_lib_pair_t;

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

extern gboolean use_colors;
extern gboolean mc_tty_color_disable;

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

const char *tty_color_get_name_by_index (int idx);
int tty_color_get_index_by_name (const char *color_name);
int tty_attr_get_bits (const char *attrs);

void tty_color_init_lib (gboolean disable, gboolean force);
void tty_color_deinit_lib (void);

void tty_color_try_alloc_lib_pair (tty_color_lib_pair_t * mc_color_pair);

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

#endif /* MC__COLOR_INTERNAL_H */