* Update to version 2.19.5
[alpine.git] / pith / osdep / color.h
blobabdacb4250da11a64748f488dbf5ff3e98273f85
1 /*
2 * $Id: color.h 1012 2008-03-26 00:44:22Z hubert@u.washington.edu $
4 * ========================================================================
5 * Copyright 2006-2008 University of Washington
6 * Copyright 2013-2014 Eduardo Chappa
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * ========================================================================
17 #ifndef PITH_OSDEP_COLOR_INCLUDED
18 #define PITH_OSDEP_COLOR_INCLUDED
21 #define RGBLEN 11
22 #define MAXCOLORLEN 11 /* longest string a color can be */
24 typedef struct COLOR_PAIR {
25 char fg[MAXCOLORLEN+1];
26 char bg[MAXCOLORLEN+1];
27 } COLOR_PAIR;
29 #define COL_BLACK 0
30 #define COL_RED 1
31 #define COL_GREEN 2
32 #define COL_YELLOW 3
33 #define COL_BLUE 4
34 #define COL_MAGENTA 5
35 #define COL_CYAN 6
36 #define COL_WHITE 7
38 #define DEFAULT_NORM_FORE_RGB "000,000,000"
39 #define DEFAULT_NORM_BACK_RGB "255,255,255"
41 /* flags for pico_set_color() */
42 #define PSC_NONE 0x0
43 #define PSC_NORM 0x1
44 #define PSC_REV 0x2
45 #define PSC_RET 0x4 /* return an allocated copy of previous color */
49 * MATCH_NORM_COLOR means that the color that is set to this value
50 * will actually use the corresponding fg or bg color from the
51 * so called Normal Color. A MATCH_NONE_COLOR means that the
52 * corresponding fg or bg color will just be left alone, so that
53 * it will stay the same as it was. This is useful when you want
54 * to change the foreground color but let the background match
55 * whatever it was before, for example in colored index lines.
57 * Note: these need to be RGBLEN in length because they are sometimes
58 * used in places where an RGB value is expected.
60 #define MATCH_NORM_COLOR "norm_padded"
61 #define MATCH_NONE_COLOR "none_padded"
63 #define MATCH_TRAN_COLOR "transparent"
66 /* exported prototypes */
67 COLOR_PAIR *new_color_pair(char *, char *);
68 void free_color_pair(COLOR_PAIR **cp);
69 int pico_is_good_colorpair(COLOR_PAIR *);
70 COLOR_PAIR *pico_set_colorp(COLOR_PAIR *, int);
73 /* required prototypes (os/app dependent ) */
74 int pico_usingcolor(void);
75 int pico_hascolor(void);
76 char *colorx(int);
77 char *color_to_asciirgb(char *);
78 int pico_is_good_color(char *);
79 COLOR_PAIR *pico_set_colors(char *, char *, int);
80 int pico_set_fg_color(char *);
81 int pico_set_bg_color(char *);
82 void pico_nfcolor(char *);
83 void pico_nbcolor(char *);
84 void pico_rfcolor(char *);
85 void pico_rbcolor(char *);
86 COLOR_PAIR *pico_get_cur_color(void);
87 COLOR_PAIR *pico_get_rev_color(void);
88 void pico_set_normal_color(void);
89 void pico_set_color_options(unsigned);
90 unsigned pico_get_color_options(void);
91 int pico_trans_is_on(void);
92 char *pico_get_last_fg_color(void);
93 char *pico_get_last_bg_color(void);
94 char *color_to_canonical_name(char *);
95 int pico_count_in_color_table(void);
98 #endif /* PITH_OSDEP_COLOR_INCLUDED */